XlPageSetup Class
Represents the object that specifies page formatting options.
Namespace: DevExpress.Export.Xl
Assembly: DevExpress.Printing.v24.1.Core.dll
NuGet Package: DevExpress.Printing.Core
Declaration
Related API Members
The following members return XlPageSetup objects:
Remarks
To adjust page settings before printing, set the IXlSheet.PageSetup property to an instance of the XlPageSetup
class that controls the page orientation (XlPageSetup.PageOrientation), paper size (XlPageSetup.PaperKind), scaling options (XlPageSetup.FitToPage, XlPageSetup.FitToWidth, XlPageSetup.FitToHeight, or XlPageSetup.Scale), printing DPI (XlPageSetup.HorizontalDpi and XlPageSetup.VerticalDpi), number of copies (XlPageSetup.Copies) and other settings.
For more information on how to set page options, refer to the How to: Specify Print Settings example.
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;