怎么将quickreport将报表转成JPG图片
如何将quickreport将报表转成JPG图片
在网上找了一段代码,结果生成的是一个空白的bmp,(转成bmp图片也行)
客户需要将报表生成JPG图片,然后发email
procedure TForm5.Button4Click(Sender: TObject);
var BMP: TBitMap;
StoredUnits: TQRUnit;
i: integer;
StoreDir: string;
begin
StoreDir:= ' '; {!!! Assign folder to store here (with ending '\ '), leave
blank to store in the .exe 's folder}
QuickRep1.Prepare;
StoredUnits:=QuickRep1.Units;
QuickRep1.Units:=Pixels;
try
for i:=1 to QuickRep1.QRPrinter.PageCount do begin
BMP:=TBitMap.Create;
try
BMP.Width:=Round(QuickRep1.Page.Width);
BMP.Height:=Round(QuickRep1.Page.Length);
QuickRep1.QRPrinter.PageNumber:=i;
BMP.Canvas.Draw(0, 0, QuickRep1.QRPrinter.Page);
BMP.SaveToFile(StoreDir+ 'Page '+IntToStr(i)+ '.bmp ');
finally
BMP.Free;
end;
end;
finally
QuickRep1.Units:=StoredUnits;
end;
end;
------解决方案--------------------
没做过用代码将报表生成JPG文件
试试用smartprinter(虚拟打印机)软件,将报表打印到本地硬盘上
在网上找了一段代码,结果生成的是一个空白的bmp,(转成bmp图片也行)
客户需要将报表生成JPG图片,然后发email
procedure TForm5.Button4Click(Sender: TObject);
var BMP: TBitMap;
StoredUnits: TQRUnit;
i: integer;
StoreDir: string;
begin
StoreDir:= ' '; {!!! Assign folder to store here (with ending '\ '), leave
blank to store in the .exe 's folder}
QuickRep1.Prepare;
StoredUnits:=QuickRep1.Units;
QuickRep1.Units:=Pixels;
try
for i:=1 to QuickRep1.QRPrinter.PageCount do begin
BMP:=TBitMap.Create;
try
BMP.Width:=Round(QuickRep1.Page.Width);
BMP.Height:=Round(QuickRep1.Page.Length);
QuickRep1.QRPrinter.PageNumber:=i;
BMP.Canvas.Draw(0, 0, QuickRep1.QRPrinter.Page);
BMP.SaveToFile(StoreDir+ 'Page '+IntToStr(i)+ '.bmp ');
finally
BMP.Free;
end;
end;
finally
QuickRep1.Units:=StoredUnits;
end;
end;
------解决方案--------------------
没做过用代码将报表生成JPG文件
试试用smartprinter(虚拟打印机)软件,将报表打印到本地硬盘上