Page setup¶
The layout of the PDF is controlled by the PrinterSettings property of the worksheet, the same settings that Excel uses when printing. Headers and footers are set via the HeaderFooter property of the worksheet.
Printer settings¶
These printer settings are used by the PDF export:
| Property | Type | Description |
|---|---|---|
LeftMargin |
double |
The left margin in inches. |
RightMargin |
double |
The right margin in inches. |
TopMargin |
double |
The top margin in inches. |
BottomMargin |
double |
The bottom margin in inches. |
HeaderMargin |
double |
The header margin in inches. |
FooterMargin |
double |
The footer margin in inches. |
Orientation |
eOrientation |
The orientation, portrait or landscape. |
PaperSize |
ePaperSize |
The paper size. Many formats are supported. |
PrintArea |
ExcelRangeBase |
The range to print. |
RepeatRows |
ExcelAddress |
Rows to repeat at the top of each page. |
RepeatColumns |
ExcelAddress |
Columns to repeat at the left of each page. |
PageOrder |
ePageOrder |
The page order: down, then over, or over, then down. |
ShowGridLines |
bool |
If grid lines should be shown. |
ShowHeaders |
bool |
If row numbers and column letters should be shown. |
CellComments |
eCellComments |
If comments should be hidden or shown at the end of the document. Showing comments as displayed on the sheet is not yet supported. |
Errors |
ePrintError |
How cell errors are displayed. |
FirstPageNumber |
int |
The starting page number. |
The following settings are not yet used by the PDF export: FitToPage, FitToWidth, FitToHeight, Scale, HorizontalCentered, VerticalCentered, BlackAndWhite and Draft.
Header and footer¶
Headers and footers are included in the PDF, including automatic text such as page numbers and dates. See Header and Footer for how to set them.