Export Rendered Report to the PDF File

This sample project demonstrates how to render and export some different reports to one PDF file. For example using three different reports - SimpleList.mrt, SimpleGroup.mrt and Master-Detail.mrt. Create new report objects and assign SimpleList.mrt, SimpleGroup.mrt and Master-Detail.mrt reports:

private void button7_Click(object sender, System.EventArgs e)
{
StiReport report1 = GetReport("SimpleList.mrt");
    StiReport report2 = GetReport("SimpleGroup.mrt");
StiReport report3 = GetReport("Master-Detail.mrt");
...


Then, create a new summary report:

...
    StiReport report = new StiReport();
    report.Render(false);
    report.RenderedPages.Clear();
...


Add rendered pages from SimpleList.mrt, SimpleGroup.mrt and Master-Detail.mrt to this report:

...
    foreach (StiPage page in report1.RenderedPages)
    {
        report.RenderedPages.Add(page);
    }

    foreach (StiPage page in report2.RenderedPages)
    {
        report.RenderedPages.Add(page);
    }

    foreach (StiPage page in report3.RenderedPages)
    {
        report.RenderedPages.Add(page);
    }
...


In the end, export the report and save result to the file:

...
report.ExportDocument(StiExportFormat.Pdf, "d:\\file.pdf");
}


In the screenshot below you can see the result of the sample code.

Export Rendered Report