IXlSheet.PrintOptions Property
Gets or sets specific options that control how a worksheet is printed.
Namespace: DevExpress.Export.Xl
Assembly: DevExpress.Printing.v24.2.Core.dll
Declaration
Property Value
Type | Description |
---|---|
XlPrintOptions | An XlPrintOptions object that contains worksheet print options. |
Remarks
Use the PrintOptions property to specify print options for a worksheet. The XlPrintOptions object enables you to include gridlines and column and row headings in the printout (XlPrintOptions.GridLines and XlPrintOptions.Headings), and center worksheet data on a page (XlPrintOptions.HorizontalCentered and XlPrintOptions.VerticalCentered). To specify formatting options for a printed page (orientation, size, scale, print quality etc.), use the IXlSheet.PageSetup property.
For more information on how to adjust print options, refer to the How to: Specify Print Settings article.
Example
The example below demonstrates how to specify print settings for a worksheet.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/excel-export-api-examples
// Specify print options for the worksheet.
sheet.PrintOptions = new XlPrintOptions();
// Print row and column headings.
sheet.PrintOptions.Headings = true;
// Print gridlines.
sheet.PrintOptions.GridLines = true;
// Center worksheet data on a printed page.
sheet.PrintOptions.HorizontalCentered = true;
sheet.PrintOptions.VerticalCentered = true;