Jump to content

Recommended Posts

Posted

Hello,

 

I am using FastReport with uniGUI. Works OK. I am able to export my report to a PDF and save to the server. I would like to return PDF to the client using sendfile once saved.

 

This is the line of code I have

 

Sendfile.(ExtractFilePath(Application.ExeName) + 'files\' + tempstr1,true);

 

 

I cannot seem to send a file, or get this to work. Does sendfile work? Is there another way?

 

John P.

Posted

You can use this:

 

* I put the fastreport components in my DataModule.

 

* I use this code 'Onclick' button.

 

procedure TfrmMenu.MyFrxShowExp();
var
  fn:String;
  FormUrlView1:TURLFrame;
begin
  fn:= 'R-' +FormatDateTime('hhmmss.zzz', Now()) +'.pdf'; // Create a unique name for report.
  DataModule1.frxReport5.PrintOptions.ShowDialog := False;
  DataModule1.frxReport5.ShowProgress:=false;
  DataModule1.frxReport5.PrintOptions.ShowDialog:=false;
  DataModule1.frxReport5.EngineOptions.SilentMode:=True;
  DataModule1.frxPDFExport1.Background:=True;
  DataModule1.frxPDFExport1.ShowProgress:=False;
  DataModule1.frxPDFExport1.ShowDialog:=False;
  DataModule1.frxPDFExport1.FileName := UniServerModule.LocalCachePath + fn;
  DataModule1.frxPDFExport1.DefaultPath := '';
  if Mainform.WebMode then begin
     DataModule1.frxReport5.PrepareReport(); // Create Report
     DataModule1.frxReport5.Export(DataModule1.frxPDFExport1); // Export Report
     FormUrlView1:=TURLFrame.Create(UniApplication);
     FormUrlView1.URLFrm.URL := UniServerModule.LocalCacheURL + fn; // Displayed on UniURLFrame
     FormUrlView1.Show;
  end else begin
     DataModule1.frxReport5.ShowReport();
  end;
end;

Posted

First thanks for your help. I need further explanation on the use of the var FormUrlView1:TURLFrame; I have not seen TURLFrame before. I am not sure what else I need to create. Do I need to create a special uniGUI frame or view?

 

John

 

BTW Sendfile does not work for me either. Does send file work? I tried a very simple path and the compiler does not recognize sendfile.

 

You can use this:

 

* I put the fastreport components in my DataModule.

 

* I use this code 'Onclick' button.

 

procedure TfrmMenu.MyFrxShowExp();
var
  fn:String;
  FormUrlView1:TURLFrame;
begin
  fn:= 'R-' +FormatDateTime('hhmmss.zzz', Now()) +'.pdf'; // Create a unique name for report.
  DataModule1.frxReport5.PrintOptions.ShowDialog := False;
  DataModule1.frxReport5.ShowProgress:=false;
  DataModule1.frxReport5.PrintOptions.ShowDialog:=false;
  DataModule1.frxReport5.EngineOptions.SilentMode:=True;
  DataModule1.frxPDFExport1.Background:=True;
  DataModule1.frxPDFExport1.ShowProgress:=False;
  DataModule1.frxPDFExport1.ShowDialog:=False;
  DataModule1.frxPDFExport1.FileName := UniServerModule.LocalCachePath + fn;
  DataModule1.frxPDFExport1.DefaultPath := '';
  if Mainform.WebMode then begin
     DataModule1.frxReport5.PrepareReport(); // Create Report
     DataModule1.frxReport5.Export(DataModule1.frxPDFExport1); // Export Report
     FormUrlView1:=TURLFrame.Create(UniApplication);
     FormUrlView1.URLFrm.URL := UniServerModule.LocalCacheURL + fn; // Displayed on UniURLFrame
     FormUrlView1.Show;
  end else begin
     DataModule1.frxReport5.ShowReport();
  end;
end;

  • 4 months later...

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...