dynamo Posted September 10, 2012 Posted September 10, 2012 I get error FastReport print on web: System Error. Code 5invalid window handle System Error. Code 1400 invalid window handle The error caused by the following line: frmFRDataModule.frxReport1.LoadFromFile(s); procedure TMainForm.UniBitBtn1Click(Sender: TObject); var s,fn:string; FormUrlView1: TFormUrlView; begin s:= ExtractFilePath(Application.ExeName) + 'report\customer.fr3' ; if WebMode then begin fn:= 'R-' +FormatDateTime('hhmmss.zzz', Now()) +'.pdf'; // Create a unique name for report. frmFRDataModule.frxReport1.PrintOptions.ShowDialog := False; frmFRDataModule.frxReport1.ShowProgress:=false; frmFRDataModule.frxReport1.PrintOptions.ShowDialog:=false; frmFRDataModule.frxReport1.EngineOptions.SilentMode:=True; frmFRDataModule.frxReport1.EngineOptions.EnableThreadSafe := True; frmFRDataModule.frxReport1.EngineOptions.DestroyForms := False; frmFRDataModule.frxPDFExport1.Background:=True; frmFRDataModule.frxPDFExport1.ShowProgress:=False; frmFRDataModule.frxPDFExport1.ShowDialog:=False; frmFRDataModule.frxPDFExport1.FileName := UniServerModule.LocalCachePath + fn; frmFRDataModule.frxPDFExport1.DefaultPath := ''; frmFRDataModule.frxDBDataset1.DataSet:=ADOQuery1; frmFRDataModule.frxReport1.DataSet:=frmFRDataModule.frxDBDataset1; frmFRDataModule.frxReport1.PreviewOptions.AllowEdit:=False; frmFRDataModule.frxReport1.LoadFromFile(s); frmFRDataModule.frxReport1.PrepareReport(); // Create Report frmFRDataModule.frxReport1.Export(frmFRDataModule.frxPDFExport1); // Export Report FormUrlView1:=TFormUrlView.Create(UniApplication); FormUrlView1.URLFrame.URL := UniServerModule.LocalCacheURL + fn; // Displayed on UniURLFrame FormUrlView1.Show; end else begin frmFRDataModule.frxReport1.Clear; frmFRDataModule.frxDBDataset1.DataSet:=ADOQuery1; frmFRDataModule.frxReport1.DataSet:=frmFRDataModule.frxDBDataset1; frmFRDataModule.frxReport1.LoadFromFile(s); frmFRDataModule.frxPDFExport1.EmbeddedFonts:=True; frmFRDataModule.frxReport1.ShowReport; end; end; What should I do ? Project1.rar Quote
stas Posted September 10, 2012 Posted September 10, 2012 I get error FastReport print on web: The error caused by the following line: frmFRDataModule.frxReport1.LoadFromFile(s); procedure TMainForm.UniBitBtn1Click(Sender: TObject); var s,fn:string; FormUrlView1: TFormUrlView; begin s:= ExtractFilePath(Application.ExeName) + 'report\customer.fr3' ; if WebMode then begin fn:= 'R-' +FormatDateTime('hhmmss.zzz', Now()) +'.pdf'; // Create a unique name for report. frmFRDataModule.frxReport1.PrintOptions.ShowDialog := False; frmFRDataModule.frxReport1.ShowProgress:=false; frmFRDataModule.frxReport1.PrintOptions.ShowDialog:=false; frmFRDataModule.frxReport1.EngineOptions.SilentMode:=True; frmFRDataModule.frxReport1.EngineOptions.EnableThreadSafe := True; frmFRDataModule.frxReport1.EngineOptions.DestroyForms := False; frmFRDataModule.frxPDFExport1.Background:=True; frmFRDataModule.frxPDFExport1.ShowProgress:=False; frmFRDataModule.frxPDFExport1.ShowDialog:=False; frmFRDataModule.frxPDFExport1.FileName := UniServerModule.LocalCachePath + fn; frmFRDataModule.frxPDFExport1.DefaultPath := ''; frmFRDataModule.frxDBDataset1.DataSet:=ADOQuery1; frmFRDataModule.frxReport1.DataSet:=frmFRDataModule.frxDBDataset1; frmFRDataModule.frxReport1.PreviewOptions.AllowEdit:=False; frmFRDataModule.frxReport1.LoadFromFile(s); frmFRDataModule.frxReport1.PrepareReport(); // Create Report frmFRDataModule.frxReport1.Export(frmFRDataModule.frxPDFExport1); // Export Report FormUrlView1:=TFormUrlView.Create(UniApplication); FormUrlView1.URLFrame.URL := UniServerModule.LocalCacheURL + fn; // Displayed on UniURLFrame FormUrlView1.Show; end else begin frmFRDataModule.frxReport1.Clear; frmFRDataModule.frxDBDataset1.DataSet:=ADOQuery1; frmFRDataModule.frxReport1.DataSet:=frmFRDataModule.frxDBDataset1; frmFRDataModule.frxReport1.LoadFromFile(s); frmFRDataModule.frxPDFExport1.EmbeddedFonts:=True; frmFRDataModule.frxReport1.ShowReport; end; end; What should I do ? Remove DialogPage From REport <TfrxDialogPage Name="DialogPage1" Font.Charset="1" Font.Color="0" Font.Height="-11" Font.Name="Tahoma" Font.Style="0" Height="200" ClientHeight="166" Left="265" Top="150" Width="300" ClientWidth="292"/> Quote
dynamo Posted September 10, 2012 Author Posted September 10, 2012 Stas, Thank you very much. DialogPage1 removed Fast Report design page and problem solved. Quote
Ronak Posted September 22, 2012 Posted September 22, 2012 Just..... if (ToBe_Displayed_in_UniURLFrame = True) then begin with TFormUrlView.Create(UniApplication) do begin URLFrame.URL := UniServerModule.LocalCacheURL +fn; // Displayed on UniURLFrame Show; end; end else begin UniSession.SendFile(UniServerModule.LocalCachePath +fn); // rely on browser setting end; Quote
fabricio1970 Posted September 24, 2012 Posted September 24, 2012 How to put a printout of the pdf within the urlframe Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.