# Insert or Add Report Pages

Use ActiveReports to run multiple reports, merge their entire page collection or specific portions and view it as a single report in section layout.

## Content



In a section layout, you can run multiple reports, merge their entire page collection or specific portions and view it as a single report. You can save the document containing merged reports to an RDF file or even export them.


> type=note
> **Note**: When you combine section reports into one document, you should always make sure that they have the same compatibility mode (CrossPlatform or GDI). Otherwise, you may get incorrect results.

These steps assume that you have already placed a Viewer control on a Windows Form and your Visual Studio project contains two section layout (code based) reports (rptOne and rptTwo). See [Windows Forms Viewer](/activereportsnet/docs/v19.2/report-readers/desktop-viewers/windows-forms-viewer) for more information.

## Add pages from one report to another

To add an entire report to another, use code like the one in the example below to iterate through the entire pages collection of a report and append it to the first report. The [Add](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Core.Document/GrapeCity.ActiveReports.Core.Document.PagesCollection-1.html#ADD) of the PagesCollection takes one parameter (value), which references a report document page.

1.  In the design view of the Form containing the Viewer, double-click the title bar of the Form to create an event-handling method for the **Form\_Load** event.
2.  Add the following code to the handler to add the entire rptTwo page collection to rptOne.
    
    The following example shows what the code for the **Add()** method looks like.
    
    To write the code in Visual Basic.NET
    
    ```vbnet
    Dim i As Integer
    Dim rpt As New rptOne()
    rpt.Run()
    Dim rpt2 As New rptTwo()
    rpt2.Run()
    For i = 0 To rpt2.Document.Pages.Count - 1
    rpt1.Document.Pages.Add(rpt2.Document.Pages(i))
    Next
    Viewer1.LoadDocument(rpt1.Document)
    ```
    
    To write the code in C#
    
    ```csharp
    int i;          
    rptOne rpt1 = new rptOne();
    rpt1.Run();
    rptTwo rpt2 = new rptTwo();
    rpt2.Run();
    for(i = 0; i < rpt2.Document.Pages.Count; i++)
    {
    rpt1.Document.Pages.Add(rpt2.Document.Pages[i]);
    
    }
    viewer1.LoadDocument(rpt1.Document);
    ```
    

## Add a range of pages from one report to another

To add a range of pages from one report to another, use the [AddRange](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Core.Document/GrapeCity.ActiveReports.Core.Document.PagesCollection-1.html#ADDRANGE). This method has two overloads, each with one parameter. The first overload takes an array of page objects which you can use to append only the specified pages from the second report onto the first (as in the example below).

1.  In the design view of the Form containing the Viewer, double-click the title bar of the Form to create an event-handling method for the **Form\_Load** event.
2.  Add the following code to the handler to use the AddRange() method to add pages from rptTwo to rptOne.
    
    The following example shows what the code for the **AddRange()** method looks like.
    
    To write the code in Visual Basic.NET
    
    ```vbnet
    Dim rpt1 As New rptOne()
    rpt1.Run()
    Dim rpt2 As New rptTwo()
    rpt2.Run()
    rpt1.Document.Pages.AddRange(New GrapeCity.ActiveReports.Document.Section.Page() {rpt2.Document.Pages(1), rpt2.Document.Pages(2)})
    Viewer1.LoadDocument(rpt1.Document)
    ```
    
    To write the code in C#
    
    ```csharp
    rptOne rpt1 = new rptOne();
    rpt1.Run();
    rptTwo rpt2 = new rptTwo(); 
    rpt2.Run();
    rpt1.Document.Pages.AddRange(new GrapeCity.ActiveReports.Document.Section.Page[] {rpt2.Document.Pages[0],rpt2.Document.Pages[1]} );
    viewer1.LoadDocument(rpt1.Document);
    ```
    

## Insert pages from one report into another

To insert pages from one report to another, use the [Insert](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Core.Document/GrapeCity.ActiveReports.Core.Document.PagesCollection-1.html#INSERT) that takes two parameters, an index, which determines where to insert the pages in the main report, and a value which references the report page to insert.

1.  In the design view of the Form containing the Viewer, double-click the title bar of the Form to create an event-handling method for the **Form\_Load** event.
2.  Add the following code to the handler to insert page 1 of rptTwo at the beginning of rptOne.
    
    The following example shows what the code for the Insert() method looks like.
    
    To write the code in Visual Basic.NET
    
    ```vbnet
    Dim rpt1 As New rptOne()
    rpt1.Run()
    Dim rpt2 As New rptTwo()
    rpt2.Run()
    rpt1.Document.Pages.Insert(0, rpt2.Document.Pages(0))
    Viewer1.LoadDocument(rpt1.Document)
    ```
    
    To write the code in C#
    
    ```csharp
    rptOne rpt1 = new rptOne(); rpt1.Run();rptTwo rpt2 = new rptTwo();rpt2.Run();rpt1.Document.Pages.Insert(0, rpt2.Document.Pages[0]);viewer1.LoadDocument(rpt1.Document);
    ```
    

## Insert a new page at a specific report location

To insert a new blank page at a specific location in the report, use the [InsertNew](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Core.Document/GrapeCity.ActiveReports.Core.Document.PagesCollection-1.html#INSERTNEW) which takes one parameter, **index**, which specifies the page after which you want to insert a new blank page.

1.  In the design view of the viewer form, double-click the title bar of the Form to create an event-handling method for the **Form\_Load** event.
2.  Add the following code to the handler to insert a blank page at the beginning of rptOne.
    
    The following example shows what the code for the InsertNew() method looks like.
    
    To write the code in Visual Basic.NET
    
    ```vbnet
    Dim rpt1 As New rptOne()
    rpt1.Run()
    rpt1.Document.Pages.InsertNew(0)
    Viewer1.Document = rpt1.Document
    ```
    
    To write the code in C#
    
    ```csharp
    rptOne rpt1 = new rptOne();rpt1.Run();rpt1.Document.Pages.InsertNew(0);viewer1.Document = rpt1.Document;
    ```
