Jump to content

Recommended Posts

Posted

I get error FastReport print on web:

 

System Error. Code 5

invalid 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

Posted

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"/>

  • 2 weeks later...
Posted

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;

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...