The requested page is not available for the requested platform. You are viewing the content for Default platform.

Print a Specified Range of Report Pages

This example demonstrates how to specify the page range of a document being printed.

To do this, assign a report instance to a ReportPrintTool, and handle the PrintingSystemBase.StartPrint event of the Print Tool's PrintToolBase.PrintingSystem.

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

private void button1_Click(object sender, System.EventArgs e) {
    ReportPrintTool printTool = new ReportPrintTool(new XtraReport1());
    printTool.PrintingSystem.StartPrint += PrintingSystem_StartPrint;
}

void PrintingSystem_StartPrint(object sender, PrintDocumentEventArgs e) {
    // Set the page range.
    e.PrintDocument.PrinterSettings.FromPage = 1;
    e.PrintDocument.PrinterSettings.ToPage = 3;
}