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:
- Add a Report to the End/Beginning
- Merge Reports: Use Data-Driven Page Sequence
- Merge Reports: Specify Page Sequence Manually
- Merge Reports in Web Applications
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();
}
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: