How to: Specify Print Settings
- 2 minutes to read
Use the Worksheet.ActiveView property to specify the following page options:
Property | Description |
---|---|
Worksheet |
Defines page margins. |
Worksheet |
Specifies page orientation. |
Worksheet |
Specifies paper size. |
Worksheet |
Specifies custom paper size for a worksheet. |
Use the Worksheet.PrintOptions property to configure print options. Print options include the following:
Property | Description |
---|---|
Worksheet |
Indicates whether to scale a worksheet to fit its data within a specified number of pages. |
Worksheet |
Specifies the number of pages a worksheet should fit within horizontally. |
Worksheet |
Specifies the number of pages a worksheet should fit within vertically. |
Worksheet |
Specifies the percentage by which to scale the worksheet content. |
Worksheet |
Specifies whether to print worksheet gridlines. |
Worksheet |
Specifies whether to print row and column headings. |
Worksheet |
Allows you to repeat specific rows and columns on the printed pages. |
Worksheet |
Allows you to print a worksheet in black and white. |
Worksheet |
Specifies the order of printed pages. |
Worksheet |
Allows you to specify the first page number. |
Worksheet |
Specifies whether to center data horizontally on the printed page. |
Worksheet |
Specifies whether to center data vertically on the printed page. |
Worksheet |
Specifies how to print cell errors. |
Important
The Worksheet
// Set page orientation to landscape.
worksheet.ActiveView.Orientation = PageOrientation.Landscape;
// Select paper size.
worksheet.ActiveView.PaperKind = DevExpress.Drawing.Printing.DXPaperKind.A4;
// Access an object that contains print options.
WorksheetPrintOptions printOptions = worksheet.PrintOptions;
// Do not print gridlines.
printOptions.PrintGridlines = false;
// Scale the worksheet to fit within the width of one page.
printOptions.FitToPage = true;
printOptions.FitToWidth = 1;
// Print in black and white.
printOptions.BlackAndWhite = true;
// Print a dash instead of a cell error message.
printOptions.ErrorsPrintMode = ErrorsPrintMode.Dash;