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;

posted @ 2017-06-26 15:08  delphi中间件  阅读(2957)  评论(0编辑  收藏  举报