If you use the grid's Print method, the entire grid will be printed unless you create a GridPrintDocument object, set its properties and call its Print method instead. By setting the GridPrintDocument's PrinterSettings.FromPage and .ToPage to define the range of pages to print. If you want to decide on a page-by-page basis, you must handle the QueryPrintPage event where you can set the IsPageSelected boolean to decide if that page should be printed.
The following code demonstrates how to print pages 2 through 5:
VB.NET | Copy Code |
---|---|
Dim printDocument As New GridPrintDocument(GridControl1) |
C# | Copy Code |
---|---|
|
Keep in mind that if you call the grid's Print or PrintPreview methods, the grid will always be printed with the default print document.