XlPrintOptions Class
Represents the object that specifies printing options for a worksheet.
Namespace: DevExpress.Export.Xl
Assembly: DevExpress.Printing.v24.2.Core.dll
Declaration
Related API Members
The following members 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/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;