Back to Devexpress

XlPrintOptions Class

corelibraries-devexpress-dot-export-dot-xl-b23c8d32.md

latest3.3 KB
Original Source

XlPrintOptions Class

Represents the object that specifies printing options for a worksheet.

Namespace : DevExpress.Export.Xl

Assembly : DevExpress.Printing.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
public class XlPrintOptions
vb
Public Class XlPrintOptions

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

csharp
// 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;
vb
' 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

Inheritance

Object XlPrintOptions

See Also

XlPrintOptions Members

XlPageSetup

Use the Excel Export API to Specify Print Settings

DevExpress.Export.Xl Namespace