参考帖子:“vfp9报表保存为高分辨率图片”,输出的图片中文字段乱码,请问如何解决?
#Defin PixelFormat32bppARGB 0x26200ADeclare Long GdipCreateBitmapFromScan0 In GDIPlus.Dll Long, Long, Long, Long, String@, Long@
Declare Long GdipGetImageGraphicsContext In GDIPlus.Dll Long, Long@
Declare Long GdipSaveImageToFile In GDIPlus.Dll Long, String@, String@, Long
Declare Long GdipDisposeImage In GDIPlus.Dll Long
Declare Long GdipDeleteGraphics In GDIPlus.Dll Long
oRL = Createobject("ReportListener")
oRL.ListenerType = 3
Report Form xxx.frx Object oRL
Local nWidth, nHeight, hBitmap, hGraphics, cFile, bmpGUID
nWidth = oRL.GetPageWidth()/4
nHeight = oRL.GetPageHeight()/4 && 分辨率太大图片好象有点不正常,情况不明。
For aa = 1 To oRL.PageTotal
hBitmap = 0
GdipCreateBitmapFromScan0(nWidth, nHeight, 0, PixelFormat32bppARGB, 0, @hBitmap)
If hBitmap == 0
? "创建Bitmap失败"
Return
Endif
hGraphics = 0
GdipGetImageGraphicsContext(hBitmap, @hGraphics)
If hGraphics == 0
GdipDisposeImage(hBitmap)
? "获取Graphics失败"
Return
Endif
oRL.OutputPage(aa, hGraphics, 1, 0,0,nWidth,nHeight, 0,0,nWidth,nHeight)
cFile = "D:\报表" + Alltrim(Str(aa)) + ".png"
bmpGUID = 0h06F47C55041AD3119A730000F81EF32E
GdipSaveImageToFile(hBitmap, Strconv(cFile+0h00,5),@bmpGUID,0)
GdipDisposeImage(hBitmap)
GdipDeleteGraphics(hGraphics)
Endfor