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 Document Range

This example illustrates how to print only a specific range of report pages.

Handle the PrintingSystemBase.StartPrint event using the XtraReport.PrintingSystem property. In the event handler, access the PrinterSettings object using the event argument’s PrintDocument property and specify the page numbers of the first and last pages to print.

using DevExpress.Xpf.Printing;
using DevExpress.XtraPrinting;
// ... 

private void simpleButton_Click(object sender, RoutedEventArgs e) {
    XtraReport1 report = new XtraReport1();
    report.PrintingSystem.StartPrint += PrintingSystem_StartPrint;
    PrintHelper.Print(report);
}

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