XlPageSetup.PageOrientation Property
Gets or sets the page orientation applied when a worksheet is being printed.
Namespace: DevExpress.Export.Xl
Assembly: DevExpress.Printing.v24.2.Core.dll
Declaration
Property Value
Type | Description |
---|---|
XlPageOrientation | An XlPageOrientation enumeration member. |
Available values:
Name | Description |
---|---|
Default | Worksheet page orientation is default. |
Portrait | Worksheet page orientation is portrait. |
Landscape | Worksheet page orientation is landscape. |
Remarks
To specify page options for a worksheet, set the IXlSheet.PageSetup property to an instance of the XlPageSetup class that controls the page orientation, paper size, scaling options, printing DPI and other settings. For more information on how to adjust page formatting options, refer to the How to: Specify Print Settings article.
Example
Note
A complete sample project is available at https://github.com/DevExpress-Examples/excel-export-api-examples
// Specify page settings for the worksheet.
sheet.PageSetup = new XlPageSetup();
// Select the paper size.
sheet.PageSetup.PaperKind = System.Drawing.Printing.PaperKind.A4;
// Set the page orientation to Landscape.
sheet.PageSetup.PageOrientation = XlPageOrientation.Landscape;
// Scale the print area to fit to one page wide.
sheet.PageSetup.FitToPage = true;
sheet.PageSetup.FitToWidth = 1;
sheet.PageSetup.FitToHeight = 0;
// Print in black and white.
sheet.PageSetup.BlackAndWhite = true;
// Specify the number of copies.
sheet.PageSetup.Copies = 2;
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the PageOrientation property.
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.