Skip to main content

XtraReport.Pages Property

Gets a collection of pages generated for this report.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.1.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