XlPrintOptions Class
Represents the object that specifies printing options for a worksheet.
Namespace: DevExpress.Export.Xl
Assembly: DevExpress.Printing.v18.1.Core.dll
Declaration
Related API Members
The following members accept/return XlPrintOptions objects:
Remarks
To specify print options for a worksheet, set the IXlSheet.PrintOptions property to an instance of the XlPrintOptions class. Utilize the XlPrintOptions object’s XlPrintOptions.GridLines and XlPrintOptions.Headings properties to include gridlines and column and row headings in the printout. To center worksheet data on a page, use the XlPrintOptions.HorizontalCentered and XlPrintOptions.VerticalCentered properties.
For more information on how to adjust print options, refer to the How to: Specify Print Settings example.
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/xl-export-api-examples-t253492
// 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;
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the XlPrintOptions class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.