unigui+fastreport报表打印
unigui+fastreport报表打印
FASTREPORT导出成PDF报表,UNIGUI的TUniURLFrame显示PDF报表并打印。
function TfrDM.GenReportPDF(const InvNum: string): string;
begin
OpenDS(InvNum); // 查询报表数据
try
frxReport1.PrintOptions.ShowDialog := False;
frxReport1.ShowProgress := false;
frxReport1.EngineOptions.SilentMode := True;
frxReport1.EngineOptions.EnableThreadSafe := True;
frxReport1.EngineOptions.DestroyForms := False;
frxReport1.EngineOptions.UseGlobalDataSetList := False;
frxReport1.LoadFromFile(UniServerModule.FilesFolderPath+'rp.fr3'); // 加载报表模板
frxPDFExport1.Background := True;
frxPDFExport1.ShowProgress := False;
frxPDFExport1.ShowDialog := False;
frxPDFExport1.FileName := UniServerModule.NewCacheFileUrl(False, 'pdf', '', '', Result, True);
frxPDFExport1.DefaultPath := '';
frxReport1.PreviewOptions.AllowEdit := False;
frxReport1.PrepareReport;
frxReport1.Export(frxPDFExport1);
finally
CloseDS;
end;
end;
procedure TUniForm1.UniFormBeforeShow(Sender: TObject);
var
dm : TfrDM;
RepUrl : string;
begin
dm := TfrDM.Create(nil);
try
RepUrl := dm.GenReportPDF(InvNum);
finally
dm.Free;
end;
UniURLFrame1.URL := RepUrl;
end;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/7080681.html