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

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;
}