Skip to main content Skip to footer

Merge Multiple ActiveReports

ActiveReports doesn't just offer an easy reporting solution; it also offers a flexible reporting style. You can create 'n' number of reports using ActiveReports and can further merge these reports to preview them as one document. The approach is simple and requires adding the PagesCollection of each report into a single report using the AddRange method. Once done, the resultant ReportDocument can be previewed in ReportViewer or exported to various formats (PDF, Excel, HTML, TIFF, Text or RTF) like any other ActiveReports report. The steps to merge the reports are simple as follows :

  1. Drag and drop the ReportViewer control onto the Windows Form
  2. In the load event of the Form add the following code :

    ReportOne _rpt1 = new ReportOne();  
     ReportTwo _rpt2 = new ReportTwo();  
     \_rpt1.Run();\_rpt2.Run();  
     \_rpt1.Document.Pages.AddRange(\_rpt2.Document.Pages);  
     viewer1.Document = _rpt1.Document;
    
  3. Run your project and view the merged report in the ReportViewer

The output will look like the following: MergedReport Refer to the attached samples that implements the above discussed approach: Download Sample : VB Download Sample : CSharp

MESCIUS inc.

comments powered by Disqus