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 12:30PM
    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 12:30PM
    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 12:30PM
    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