Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Merge Reports

  • 2 minutes to read

Complex reports can be a combination of several simple reports, pages, or ranges. The following help topics describe how to merge reports:

You can create pages in a separate report and merge them into the base report. This allows you to print and export the merged pages as a single document, and to retain the original settings and orientation of the report pages:

private void MergeTwoReports() {
    // Create the 1st report and generate its document.
    XtraReport1 report1 = new XtraReport1();
    report1.CreateDocument();

    // Create the 2nd report and generate its document.
    XtraReport2 report2 = new XtraReport2();
    report2.CreateDocument();

    // Merge pages of two reports, page-by-page.
    int minPageCount = Math.Min(report1.Pages.Count, report2.Pages.Count);
    for (int i = 0; i < minPageCount; i++) {
        report1.Pages.Insert(i * 2 + 1, report2.Pages[i]);
    }
    if (report2.Pages.Count != minPageCount) {
        for (int i = minPageCount; i < report2.Pages.Count; i++) {
            report1.Pages.Add(report2.Pages[i]);
        }
    }

    // Reset all page numbers in the resulting document.
    report1.PrintingSystem.ContinuousPageNumbering = true;

    // Show the Print Preview form.
    report1.ShowPreviewDialog();
}

report-merging

View Example: Reporting for WinForms- How to combine document report pages

Complex reports can also be constructed based on several data sources or data tables. For more information, review the following help topics:

#Merge Reports in the End-User Report Designer

Tutorials that explain how to use this functionality in EUD Report Designers for WinForms and Web are included in the End-User Documentation online help section: