How To: Print a Range of Pages from Code
KnowledgeBase for ActiveReports for .NET
How To: Print a Range of Pages from Code
02-19-2008, 11:03 AM
How To: Print a Range of Pages from Code
When printing from code you can control all printing settings. This can be very helpful when, for example, you're creating a custom print dialog or designing an automated printing process which avoids displaying any dialogs. All settings that can be specified in the print dialog can be specified in code via the Printer property of ActiveReports' Document object. This example demonstrates using code to configure a range of pages before printing a report. The PrintRange property indicates that only some of the report's pages are to be printed. The FromPage and ToPage properties indicate the first and last pages of the range to be printed.
rpt.Document.Printer.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.SomePages;
rpt.Document.Printer.PrinterSettings.FromPage = start;
rpt.Document.Printer.PrinterSettings.ToPage = end;
rpt.Document.Print(false, false, false);