Print and Preview diffrent after Batch

I try to make a Batch report with fastreport version 5.5.11. Using Delphi Berlin.
That???s basically my code:
var
  Filename : string;
  pdf : String;
  frm : TfrmReportPreview;
begin
  Filename :=  'Name des Reports;
  pdf      := '.pdf';
  frm := TfrmReportPreview.Create(self);
    try

      AddDatasetsListe(frm);
      frm.BeginPrepareBatchReport;
      frm.LoadFromFile(TwiPathUtils.ReportPath + ???Report1.fr3');
      frm.PrepareBatchReport();
      Refresh_cdsMahnungen();
      AReportfrx.AddDataSet(DBDSPrintMahnungen);
      AReportfrx.LoadFromFile(TwiPathUtils.ReportPath + ???Report2.fr3');
      AReportfrx.PrepareBatchReport();
      AReportfrx.EndPrepareBatchReport();
      AReportfrx.GetSaveFilename(Filename,pdf, pdf)
      AReportfrx.ShowModal;
      AReportfrx.ShowReport(rmPrint);
  
    finally
      frm.Free;
    end;

With the Showmodal I get what I want in the Preview but with the ShowReport it is just printing the second part of the file. Also the result has the name just of the second file. And if I use the Create PDF Option as a Printer, it makes a PDF just of the second page.



Comments

  • PolomintPolomint Australia
    edited 1:37PM
    Excuse what may be a dumb question, but...

    You've omitted the parameter in both calls to PrepareBatchReport. I don't have FastReport or the manual available at the moment, but I think you need to specify "False" in the second (and subsequent) calls...

    Cheers, Paul
  • edited 1:37PM
    I saw something like that here:
    https://www.delphipraxis.net/181470-fast-re...ch-reports.html
    procedure TForm8.CreateReport;
    begin
      frxReport1.LoadFromFile(ExtractFilePath(Application.ExeName) + '1.fr3');
      frxReport1.PrepareReport;
    
      frxReport1.LoadFromFile(ExtractFilePath(Application.ExeName) + '2.fr3');
      frxReport1.PrepareReport(false);
    

    But in Verison 5 there is no prepareReport and the prepareBatchReport don't have a parameter.
  • gpigpi
    edited 1:37PM
    wrote:
    But in Verison 5 there is no prepareReport and the prepareBatchReport don't have a parameter.
    FR 5 have TfrxReport.PrepareReport(ClearLastReport: Boolean = True): Boolean;

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.