Export many reports to one PDF File

edited 2:38AM in FastReport .NET
Hello,
in my application a test report is created for each test object. The user can select the reports he want to see and print it out.
I have a function which iterates through all selected rows and print out the report.
Now I want to create a function to export all selected reports into one PDF file. To export the report to an pdf file I can simply call
export = new FastReport.Export.Pdf.PDFExport();
report1.Export(export, "result.pdf");
but this will create one file for each report. When I had a look at the report1.Prepare(true); parameter it says the boolean parameter is either for appending the report to the one before or create a new one. But this won't work for me. How can I export multiple reports in one single PDF file ?

Comments

  • edited 2:38AM
    Composing several reports into one is the task of the reporting engine, not of the export module. Before calling the Export routine, you should setup the Report object so as it will combine all reports into one.
  • edited 2:38AM
    Ok, and how ? Do you have an example ?
    Just to make clear it is always the same report which is called with different data e.g 10 times. After this procedure I want to have one PDF file containing the data of all 10 reports.
  • edited May 2011
    The code should look like this:
    Report.LoadFromFile('Report1.fr3');
    Report.PrepareReport();
    Report.LoadFromFile('Report2.fr3');
    Report.PrepareReport(False);
    Report.LoadFromFile('Report3.fr3');
    Report.PrepareReport(False);
    Report.Export(....);
    

    or like this:
    Report1.LoadFromFile('Report1.fr3');
    Report1.PrepareReport();
    Report2.LoadFromFile('Report2.fr3');
    Report2.PrepareReport();
    Report1.PreviewPages.AddFrom(Report2);
    Report1.Export(....);
    
  • edited 2:38AM
    Thanks,
    this works for me. I had to change the parameter in prepare from fals to true, because im always using the same report

Leave a Comment