Skip to main content

ApiPageSetup

Class representing the page setup (print layout) of a worksheet.

Properties​

NameTypeDescription
AlignMarginsHeaderFooterbooleanReturns or sets whether the header and footer margins are aligned with the page margins.
BottomMarginnumberReturns or sets the bottom margin size measured in millimeters.
CenterFooterstringReturns or sets the center part of the (odd) footer.
CenterHeaderstringReturns or sets the center part of the (odd) header.
CenterHorizontallybooleanReturns or sets whether the worksheet is centered horizontally on the page when printed.
CenterVerticallybooleanReturns or sets whether the worksheet is centered vertically on the page when printed.
DifferentFirstPageHeaderFooterbooleanReturns or sets whether a different header and footer is used on the first printed page.
EvenPageApiPageReturns the header and footer of the even pages.
FirstPageApiPageReturns the header and footer of the first page.
FirstPageNumbernumber | nullReturns or sets the first page number (null means automatic).
FitToPagesTallnumberReturns or sets the number of pages tall the worksheet is scaled to when printed (0 means automatic).
FitToPagesWidenumberReturns or sets the number of pages wide the worksheet is scaled to when printed (0 means automatic).
FooterMarginnumberReturns or sets the distance from the bottom of the page to the footer, in millimeters.
HeaderMarginnumberReturns or sets the distance from the top of the page to the header, in millimeters.
LeftFooterstringReturns or sets the left part of the (odd) footer.
LeftHeaderstringReturns or sets the left part of the (odd) header.
LeftMarginnumberReturns or sets the left margin size measured in millimeters.
OddAndEvenPagesHeaderFooterbooleanReturns or sets whether different headers and footers are used on odd and even printed pages.
OrientationPageOrientationReturns or sets the page orientation.
PaperSizePaperSizeReturns or sets the paper size.
ParentApiWorksheetReturns the parent worksheet of the page setup.
PrintAreastringReturns or sets the range to be printed (empty string prints the whole sheet).
PrintGridlinesbooleanReturns or sets whether the cell gridlines are printed.
PrintHeadingsbooleanReturns or sets whether the row and column headings are printed.
PrintTitleColumnsstringReturns or sets the columns repeated at the left of each printed page.
PrintTitleRowsstringReturns or sets the rows repeated at the top of each printed page.
RightFooterstringReturns or sets the right part of the (odd) footer.
RightHeaderstringReturns or sets the right part of the (odd) header.
RightMarginnumberReturns or sets the right margin size measured in millimeters.
ScaleWithDocHeaderFooterbooleanReturns or sets whether the header and footer are scaled with the document when printing.
TopMarginnumberReturns or sets the top margin size measured in millimeters.
ZoomnumberReturns or sets the print scaling factor in percent (10-400).

Methods​

The following table lists the available methods.

MethodReturnsDescription
GetAlignMarginsHeaderFooterbooleanReturns whether the header and footer margins are aligned with the page margins.
GetBottomMarginnumberReturns the size of the bottom margin.
GetCenterFooterstringReturns the center part of the footer used when the worksheet is printed.
GetCenterHeaderstringReturns the center part of the header used when the worksheet is printed.
GetCenterHorizontallybooleanReturns whether the worksheet is centered horizontally on the page when printed.
GetCenterVerticallybooleanReturns whether the worksheet is centered vertically on the page when printed.
GetDifferentFirstPageHeaderFooterbooleanReturns whether a different header and footer is used on the first printed page.
GetEvenPageApiPageReturns the header and footer of the even pages of the worksheet. The returned object is meaningful when ApiPageSetup#GetOddAndEvenPagesHeaderFooter is enabled.
GetFirstPageApiPageReturns the header and footer of the first page of the worksheet. The returned object is meaningful when ApiPageSetup#GetDifferentFirstPageHeaderFooter is enabled.
GetFirstPageNumbernumber | nullReturns the first page number used when the worksheet is printed. Returns null when the page numbering is automatic.
GetFitToPagesTallnumberReturns the number of pages tall the worksheet is scaled to when printed (0 means automatic).
GetFitToPagesWidenumberReturns the number of pages wide the worksheet is scaled to when printed (0 means automatic).
GetFooterMarginnumberReturns the distance from the bottom of the page to the footer.
GetHeaderMarginnumberReturns the distance from the top of the page to the header.
GetLeftFooterstringReturns the left part of the footer used when the worksheet is printed.
GetLeftHeaderstringReturns the left part of the header used when the worksheet is printed.
GetLeftMarginnumberReturns the size of the left margin.
GetOddAndEvenPagesHeaderFooterbooleanReturns whether different headers and footers are used on odd and even printed pages.
GetOrientationPageOrientationReturns the page orientation used when the worksheet is printed.
GetPaperSizePaperSizeReturns the paper size used when the worksheet is printed.
GetParentApiWorksheetReturns the worksheet that owns this page setup.
GetPrintAreastringReturns the range to be printed (the print area) as a string, or an empty string when the whole sheet is printed.
GetPrintGridlinesbooleanReturns whether cell gridlines are printed with the worksheet.
GetPrintHeadingsbooleanReturns whether row and column headings are printed with the worksheet.
GetPrintTitleColumnsstringReturns the columns that are repeated at the left of each printed page, or an empty string if none.
GetPrintTitleRowsstringReturns the rows that are repeated at the top of each printed page, or an empty string if none.
GetRightFooterstringReturns the right part of the footer used when the worksheet is printed.
GetRightHeaderstringReturns the right part of the header used when the worksheet is printed.
GetRightMarginnumberReturns the size of the right margin.
GetScaleWithDocHeaderFooterbooleanReturns whether the header and footer are scaled with the document when it is scaled for printing.
GetTopMarginnumberReturns the size of the top margin.
GetZoomnumberReturns the scaling factor (in percent) used when the worksheet is printed.
SetAlignMarginsHeaderFooterbooleanSets whether the header and footer margins are aligned with the page margins.
SetBottomMarginbooleanSets the size of the bottom margin.
SetCenterFooterbooleanSets the center part of the footer used when the worksheet is printed.
SetCenterHeaderbooleanSets the center part of the header used when the worksheet is printed.
SetCenterHorizontallybooleanSets whether the worksheet is centered horizontally on the page when printed.
SetCenterVerticallybooleanSets whether the worksheet is centered vertically on the page when printed.
SetDifferentFirstPageHeaderFooterbooleanSets whether a different header and footer is used on the first printed page.
SetFirstPageNumberbooleanSets the first page number used when the worksheet is printed.
SetFitToPagesTallbooleanSets the number of pages tall the worksheet is scaled to when printed (0 means automatic). Setting this property turns on the "fit to page" mode.
SetFitToPagesWidebooleanSets the number of pages wide the worksheet is scaled to when printed (0 means automatic). Setting this property turns on the "fit to page" mode.
SetFooterMarginbooleanSets the distance from the bottom of the page to the footer.
SetHeaderMarginbooleanSets the distance from the top of the page to the header.
SetLeftFooterbooleanSets the left part of the footer used when the worksheet is printed.
SetLeftHeaderbooleanSets the left part of the header used when the worksheet is printed.
SetLeftMarginbooleanSets the size of the left margin.
SetOddAndEvenPagesHeaderFooterbooleanSets whether different headers and footers are used on odd and even printed pages.
SetOrientationbooleanSets the page orientation used when the worksheet is printed.
SetPaperSizebooleanSets the paper size used when the worksheet is printed.
SetPrintAreabooleanSets the range to be printed (the print area). Pass an empty string to clear it and print the whole sheet.
SetPrintGridlinesbooleanSets whether cell gridlines are printed with the worksheet.
SetPrintHeadingsbooleanSets whether row and column headings are printed with the worksheet.
SetPrintTitleColumnsbooleanSets the columns that are repeated at the left of each printed page. Pass an empty string to clear them.
SetPrintTitleRowsbooleanSets the rows that are repeated at the top of each printed page. Pass an empty string to clear them.
SetRightFooterbooleanSets the right part of the footer used when the worksheet is printed.
SetRightHeaderbooleanSets the right part of the header used when the worksheet is printed.
SetRightMarginbooleanSets the size of the right margin.
SetScaleWithDocHeaderFooterbooleanSets whether the header and footer are scaled with the document when it is scaled for printing.
SetTopMarginbooleanSets the size of the top margin.
SetZoombooleanSets the scaling factor (in percent) used when the worksheet is printed. Setting this property turns off the "fit to page" mode.