Skip to main content Skip to footer

Merge Multiple PageReports

In one of my last blog, I discussed how multiple SectionReports can be merged to preview them as one document. Let's now discuss if the same can be implemented when working with PageReports. A simple and straight answer would be - No, the merging of pages is not possible in PageReports. Since the PageReports do not have a concept of paging, therefore the PageCollection cannot be accessed and hence the page reports cannot be merged. Does that mean I cannot think about getting my multiple PageReports at one place in a single document and will have to deal with each report explicitly. Not really. There might be no direct method available for merging PageReports, but a workaround can be to make use of SubReports. The second report can be added in the first PageReport and this way merging can be achieved. Following are the three simple steps to merge multiple PageReports : 1. Drag and drop the ReportViewer control onto the Windows Form 2. In the load event of the Form add the following code :

Dim subreport As GrapeCity.ActiveReports.PageReportModel.Subreport = New GrapeCity.ActiveReports.PageReportModel.Subreport()  
subreport.ReportName = "PageReport2.rdlx"  
_pageReport.Report.Body.ReportItems.Add(subreport)  

Dim runtime As GrapeCity.ActiveReports.Document.PageDocument = New GrapeCity.ActiveReports.Document.PageDocument(_pageReport)  
Viewer1.LoadDocument(runtime)

3. Run your project and view the merged report in the ReportViewer The output will look like the following : Output_MergedReports Refer to the attached samples that implements the above discussed approach : Download VB Sample Download CS Sample

Conclusion :

In this blog, I have talked about adding just one report into another. Similarly, two or more reports can be merged and in the desired sequence.

MESCIUS inc.

comments powered by Disqus