ActiveReports provides the users with various options to customize their reports as per their requirement. Quite often, customers have asked if their reports can be created with pages of mixed orientation. As of now, a report with some pages in landscape mode and some in portrait mode cannot be created directly. This is because the page orientation can be set only in the ReportStart event of the report and hence once it is set, it cannot be changed. In this blog we will discuss a workaround that can be used to show some of pages of the report in Portrait Orientation while some in Landscape Orientation. The approach is simple :
- Create two reports where one of reports shows the pages in Portrait orientation and the other report in Landscape orientation.
- Finally, merge both the reports together to show both the orientations within the same report.
The pages can be added at the end or in between the report using the Add or Insert method of PagesCollection Class. Please refer to the following code snippet :
'To add the pages at the end : rpt.Document.Pages.Add(rpt2.Document.Pages(0)) 'To insert the pages in between : rpt.Document.Pages.Insert(0, rpt2.Document.Pages(0))
The attached sample shows how the pages can be added either at the end or inserted at the alternative position in the report. Once the pages are inserted alternatively, the resultant report would look like the following : Refer to the attached samples for the complete implementation : Download Sample : CSharp Download Sample : VB You may also refer to the following documentation link for more information : How to : Insert or Add Pages