delphi如何将quickreport报表转成图片 50
如何将quickreport将报表转成JPG或者BMP图片在网上找了一段代码,结果生成的是一个空白的bmp,(转成bmp图片也行)客户需要将报表预览的同时生成JPG图片,...
如何将quickreport将报表转成JPG或者BMP图片
在网上找了一段代码,结果生成的是一个空白的bmp,(转成bmp图片也行)
客户需要将报表预览的同时生成JPG图片,
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; 展开
在网上找了一段代码,结果生成的是一个空白的bmp,(转成bmp图片也行)
客户需要将报表预览的同时生成JPG图片,
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; 展开
2017-11-15 · 知道合伙人互联网行家
关注
展开全部
如何将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(虚拟打印机)软件,将报表打印到本地硬盘上
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询