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

XtraReport.Pages Property

Gets a collection of pages generated for this report.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.2.dll

NuGet Package: DevExpress.Reporting.Core

#Declaration

[Browsable(false)]
public PageList Pages { get; }

#Property Value

Type Description
PageList

A PageList object, specifying a collection of pages.

#Remarks

After calling the XtraReport.CreateDocument method (or after calling the PrintTool.ShowPreview or PrintTool.ShowPreviewDialog methods for the first time), you can access all pages of the generated Document using the Pages property.

The PageList object, which is the returned collection of pages, exposes methods that allow you to reorder and remove pages, as well as to add and insert pages from other reports (see Merging Reports for details).

The following code reorders document pages to produce a booklet (first page, last page, second page, last but one, third page, etc.):

using DevExpress.XtraReports.UI;
// ...

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

    // Preserve the original page numbers on all pages.
    report1.PrintingSystem.ContinuousPageNumbering = false;

    // Create a booklet.
    int centerPageIndex = Convert.ToInt32((report1.Pages.Count - 1) / 2);
    for (int i = 0; i < centerPageIndex; i++) {
        report1.Pages.Insert(i * 2 + 1, report1.Pages[report1.Pages.Count - 1]);
    }

    // Show the Print Preview form (in a WinForms application).
    ReportPrintTool printTool = new ReportPrintTool(report1);
    printTool.ShowPreviewDialog();
}

You can also add an empty page using the PrintingSystemBase.CreatePage method of the report’s XtraReport.PrintingSystem.

Use the PrintingSystemBase.ContinuousPageNumbering property to specify whether to update the page numbers after customizing the collection of pages or preserve the page numbers from the original document(s).

The following code snippets (auto-collected from DevExpress Examples) contain references to the Pages property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also