PageSetup

PageSetup class

Encapsulates the object that represents the page setup description. The PageSetup object contains all page setup options.

Methods

NameDescription
clearHeaderFooter()Clears header and footer setting.
copy(source, copyOptions)Copies the setting of the page setup.
customPaperSize(width, height)Sets the custom paper size, in unit of inches.
getBlackAndWhite()Represents if elements of the document will be printed in black and white.
getBottomMargin()Represents the size of the bottom margin, in unit of centimeters.
getBottomMarginInch()Represents the size of the bottom margin, in unit of inches.
getCenterHorizontally()Represent if the sheet is printed centered horizontally.
getCenterVertically()Represent if the sheet is printed centered vertically.
getCommands(headerFooterScript)Gets all commands of header or footer.
getEvenFooter(section)Gets a script formatting the even footer of an Excel file.
getEvenHeader(section)Gets a script formatting the even header of an Excel file.
getFirstPageFooter(section)Gets a script formatting the first page footer of an Excel file.
getFirstPageHeader(section)Gets a script formatting the first page header of an Excel file.
getFirstPageNumber()Represents the first page number that will be used when this sheet is printed.
getFitToPagesTall()Represents the number of pages tall the worksheet will be scaled to when it’s printed. The default value is 1. You have
getFitToPagesWide()Represents the number of pages wide the worksheet will be scaled to when it’s printed. The default value is 1. You have
getFooter(section)Gets a script formatting the footer of an Excel file.
getFooterMargin()Represents the distance from the bottom of the page to the footer, in unit of centimeters.
getFooterMarginInch()Represents the distance from the bottom of the page to the footer, in unit of inches.
getHeader(section)Gets a script formatting the header of an Excel file.
getHeaderMargin()Represents the distance from the top of the page to the header, in unit of centimeters.
getHeaderMarginInch()Represents the distance from the top of the page to the header, in unit of inches.
getLeftMargin()Represents the size of the left margin, in unit of centimeters.
getLeftMarginInch()Represents the size of the left margin, in unit of inches.
getODSPageBackground()Gets the background of ODS.
getOrder()Represents the order that Microsoft Excel uses to number pages when printing a large worksheet. The value of the propert
getOrientation()Represents page print orientation. The value of the property is PageOrientationType integer constant.
getPaperHeight()Gets the height of the paper in unit of inches , considered page orientation.
getPaperSize()Represents the size of the paper. The value of the property is PaperSizeType integer constant.
getPaperWidth()Gets the width of the paper in unit of inches, considered page orientation.
getPicture(isHeader, section)Gets the Picture object of the header / footer.
getPicture(isFirst, isEven, isHeader, section)Gets the Picture object of the header / footer.
getPrintArea()Represents the range to be printed.
getPrintComments()Represents the way comments are printed with the sheet. The value of the property is PrintCommentsType integer constant.
getPrintCopies()Get and sets number of copies to print.
getPrintDraft()Represents if the sheet will be printed without graphics.
getPrintErrors()Specifies the type of print error displayed. The value of the property is PrintErrorsType integer constant.
getPrintGridlines()Represents if cell gridlines are printed on the page.
getPrintHeadings()Represents if row and column headings are printed with this page.
getPrintQuality()Represents the print quality.
getPrintTitleColumns()Represents the columns that contain the cells to be repeated on the left side of each page.
getPrintTitleRows()Represents the rows that contain the cells to be repeated at the top of each page.
getPrinterSettings()Gets and sets the settings of the default printer.
getRightMargin()Represents the size of the right margin, in unit of centimeters.
getRightMarginInch()Represents the size of the right margin, in unit of inches.
getTopMargin()Represents the size of the top margin, in unit of centimeters.
getTopMarginInch()Represents the size of the top margin, in unit of inches.
getZoom()Represents the scaling factor in percent. It should be between 10 and 400.
isAutoFirstPageNumber()Indicates whether the first the page number is automatically assigned.
isAutomaticPaperSize()Indicates whether the paper size is automatic.
isHFAlignMargins()Indicates whether header and footer margins are aligned with the page margins. If this property is true, the left header
isHFDiffFirst()True means that the header/footer of the first page is different with other pages.
isHFDiffOddEven()True means that the header/footer of the odd pages is different with odd pages.
isHFScaleWithDoc()Indicates whether header and footer are scaled with document scaling. Only applies for Excel 2007.
isPercentScale()If this property is False, the FitToPagesWide and FitToPagesTall properties control how the worksheet is scaled.
setAutoFirstPageNumber()Indicates whether the first the page number is automatically assigned.
setBlackAndWhite()Represents if elements of the document will be printed in black and white.
setBottomMargin()Represents the size of the bottom margin, in unit of centimeters.
setBottomMarginInch()Represents the size of the bottom margin, in unit of inches.
setCenterHorizontally()Represent if the sheet is printed centered horizontally.
setCenterVertically()Represent if the sheet is printed centered vertically.
setEvenFooter(section, footerScript)Sets a script formatting the even page footer of an Excel file. Only effect in Excel 2007 when IsHFDiffOddEven is true.
setEvenHeader(section, headerScript)Sets a script formatting the even page header of an Excel file. Only effect in Excel 2007 when IsHFDiffOddEven is true.
setFirstPageFooter(section, footerScript)Sets a script formatting the first page footer of an Excel file.
setFirstPageHeader(section, headerScript)Sets a script formatting the first page header of an Excel file. Only effect in Excel 2007 when IsHFDiffFirst is true.
setFirstPageNumber()Represents the first page number that will be used when this sheet is printed.
setFitToPages(wide, tall)Sets the number of pages the worksheet will be scaled to when it’s printed.
setFitToPagesTall()Represents the number of pages tall the worksheet will be scaled to when it’s printed. The default value is 1. You have
setFitToPagesWide()Represents the number of pages wide the worksheet will be scaled to when it’s printed. The default value is 1. You have
setFooter(section, footerScript)Sets a script formatting the footer of an Excel file. Script commands:CommandDescription&PCurrent page number &NPage cou
setFooterMargin()Represents the distance from the bottom of the page to the footer, in unit of centimeters.
setFooterMarginInch()Represents the distance from the bottom of the page to the footer, in unit of inches.
setFooterPicture(section, footerPicture)Sets an image in the footer of a worksheet.
setHFAlignMargins()Indicates whether header and footer margins are aligned with the page margins. If this property is true, the left header
setHFDiffFirst()True means that the header/footer of the first page is different with other pages.
setHFDiffOddEven()True means that the header/footer of the odd pages is different with odd pages.
setHFScaleWithDoc()Indicates whether header and footer are scaled with document scaling. Only applies for Excel 2007.
setHeader(section, headerScript)Sets a script formatting the header of an Excel file. Script commands:CommandDescription&PCurrent page number &NPage cou
setHeaderMargin()Represents the distance from the top of the page to the header, in unit of centimeters.
setHeaderMarginInch()Represents the distance from the top of the page to the header, in unit of inches.
setHeaderPicture(section, headerPicture)Sets an image in the header of a worksheet.
setLeftMargin()Represents the size of the left margin, in unit of centimeters.
setLeftMarginInch()Represents the size of the left margin, in unit of inches.
setOrder()Represents the order that Microsoft Excel uses to number pages when printing a large worksheet. The value of the propert
setOrientation()Represents page print orientation. The value of the property is PageOrientationType integer constant.
setPaperSize()Represents the size of the paper. The value of the property is PaperSizeType integer constant.
setPercentScale()If this property is False, the FitToPagesWide and FitToPagesTall properties control how the worksheet is scaled.
setPicture(isFirst, isEven, isHeader, section, imageData)Sets an image in the header/footer of a worksheet.
setPrintArea()Represents the range to be printed.
setPrintComments()Represents the way comments are printed with the sheet. The value of the property is PrintCommentsType integer constant.
setPrintCopies()Get and sets number of copies to print.
setPrintDraft()Represents if the sheet will be printed without graphics.
setPrintErrors()Specifies the type of print error displayed. The value of the property is PrintErrorsType integer constant.
setPrintGridlines()Represents if cell gridlines are printed on the page.
setPrintHeadings()Represents if row and column headings are printed with this page.
setPrintQuality()Represents the print quality.
setPrintTitleColumns()Represents the columns that contain the cells to be repeated on the left side of each page.
setPrintTitleRows()Represents the rows that contain the cells to be repeated at the top of each page.
setPrinterSettings()Gets and sets the settings of the default printer.
setRightMargin()Represents the size of the right margin, in unit of centimeters.
setRightMarginInch()Represents the size of the right margin, in unit of inches.
setTopMargin()Represents the size of the top margin, in unit of centimeters.
setTopMarginInch()Represents the size of the top margin, in unit of inches.
setZoom()Represents the scaling factor in percent. It should be between 10 and 400.

clearHeaderFooter()

Clears header and footer setting.

copy(source, copyOptions)

Copies the setting of the page setup.

ParameterTypeDescription
sourcePageSetupThe source.
copyOptionsCopyOptionsThe copy options.

customPaperSize(width, height)

Sets the custom paper size, in unit of inches.

ParameterTypeDescription
widthNumberThe width of the paper.
heightNumberThe height of the paper.

getBlackAndWhite()

Represents if elements of the document will be printed in black and white.

getBottomMargin()

Represents the size of the bottom margin, in unit of centimeters.

getBottomMarginInch()

Represents the size of the bottom margin, in unit of inches.

getCenterHorizontally()

Represent if the sheet is printed centered horizontally.

getCenterVertically()

Represent if the sheet is printed centered vertically.

getCommands(headerFooterScript)

Gets all commands of header or footer.

ParameterTypeDescription
headerFooterScriptStringThe header/footer script

Returns: Array ofHeaderFooterCommand — Array ofHeaderFooterCommand Returns all commands of header or footer.

getEvenFooter(section)

Gets a script formatting the even footer of an Excel file.

ParameterTypeDescription
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.

getEvenHeader(section)

Gets a script formatting the even header of an Excel file.

ParameterTypeDescription
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.

getFirstPageFooter(section)

Gets a script formatting the first page footer of an Excel file.

ParameterTypeDescription
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.

getFirstPageHeader(section)

Gets a script formatting the first page header of an Excel file.

ParameterTypeDescription
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.

getFirstPageNumber()

Represents the first page number that will be used when this sheet is printed.

getFitToPagesTall()

Represents the number of pages tall the worksheet will be scaled to when it’s printed. The default value is 1. You have to set FitToPagesWide as zero if you want to fit all rows on one page.

getFitToPagesWide()

Represents the number of pages wide the worksheet will be scaled to when it’s printed. The default value is 1. You have to set FitToPagesTall as zero if you want to fit all columns on one page.

getFooter(section)

Gets a script formatting the footer of an Excel file.

ParameterTypeDescription
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.

getFooterMargin()

Represents the distance from the bottom of the page to the footer, in unit of centimeters.

getFooterMarginInch()

Represents the distance from the bottom of the page to the footer, in unit of inches.

getHeader(section)

Gets a script formatting the header of an Excel file.

ParameterTypeDescription
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.

getHeaderMargin()

Represents the distance from the top of the page to the header, in unit of centimeters.

getHeaderMarginInch()

Represents the distance from the top of the page to the header, in unit of inches.

getLeftMargin()

Represents the size of the left margin, in unit of centimeters.

getLeftMarginInch()

Represents the size of the left margin, in unit of inches.

getODSPageBackground()

Gets the background of ODS.

getOrder()

Represents the order that Microsoft Excel uses to number pages when printing a large worksheet. The value of the property is PrintOrderType integer constant.

getOrientation()

Represents page print orientation. The value of the property is PageOrientationType integer constant.

getPaperHeight()

Gets the height of the paper in unit of inches , considered page orientation.

getPaperSize()

Represents the size of the paper. The value of the property is PaperSizeType integer constant.

getPaperWidth()

Gets the width of the paper in unit of inches, considered page orientation.

getPicture(isHeader, section)

Gets the Picture object of the header / footer.

ParameterTypeDescription
isHeaderbooleanIndicates whether it is in the header or footer.
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.

Returns: Picture — Picture Returns Picture object. Returns null if there is no picture.

getPicture(isFirst, isEven, isHeader, section)

Gets the Picture object of the header / footer.

ParameterTypeDescription
isFirstbooleanIndicates whether getting the picture of first page header/footer.
isEvenbooleanIndicates whether getting the picture of even page header/footer.
isHeaderbooleanIndicates whether getting the picture of header/footer.
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.

Returns: Picture — Picture Returns Picture object.

getPrintArea()

Represents the range to be printed.

getPrintComments()

Represents the way comments are printed with the sheet. The value of the property is PrintCommentsType integer constant.

getPrintCopies()

Get and sets number of copies to print.

getPrintDraft()

Represents if the sheet will be printed without graphics.

getPrintErrors()

Specifies the type of print error displayed. The value of the property is PrintErrorsType integer constant.

getPrintGridlines()

Represents if cell gridlines are printed on the page.

getPrintHeadings()

Represents if row and column headings are printed with this page.

getPrintQuality()

Represents the print quality.

getPrintTitleColumns()

Represents the columns that contain the cells to be repeated on the left side of each page.

getPrintTitleRows()

Represents the rows that contain the cells to be repeated at the top of each page.

getPrinterSettings()

Gets and sets the settings of the default printer.

getRightMargin()

Represents the size of the right margin, in unit of centimeters.

getRightMarginInch()

Represents the size of the right margin, in unit of inches.

getTopMargin()

Represents the size of the top margin, in unit of centimeters.

getTopMarginInch()

Represents the size of the top margin, in unit of inches.

getZoom()

Represents the scaling factor in percent. It should be between 10 and 400.

isAutoFirstPageNumber()

Indicates whether the first the page number is automatically assigned.

isAutomaticPaperSize()

Indicates whether the paper size is automatic.

isHFAlignMargins()

Indicates whether header and footer margins are aligned with the page margins. If this property is true, the left header and footer will be aligned with the left margin, and the right header and footer will be aligned with the right margin. This option is enabled by default.

isHFDiffFirst()

True means that the header/footer of the first page is different with other pages.

isHFDiffOddEven()

True means that the header/footer of the odd pages is different with odd pages.

isHFScaleWithDoc()

Indicates whether header and footer are scaled with document scaling. Only applies for Excel 2007.

isPercentScale()

If this property is False, the FitToPagesWide and FitToPagesTall properties control how the worksheet is scaled.

setAutoFirstPageNumber()

Indicates whether the first the page number is automatically assigned.

setBlackAndWhite()

Represents if elements of the document will be printed in black and white.

setBottomMargin()

Represents the size of the bottom margin, in unit of centimeters.

setBottomMarginInch()

Represents the size of the bottom margin, in unit of inches.

setCenterHorizontally()

Represent if the sheet is printed centered horizontally.

setCenterVertically()

Represent if the sheet is printed centered vertically.

setEvenFooter(section, footerScript)

Sets a script formatting the even page footer of an Excel file. Only effect in Excel 2007 when IsHFDiffOddEven is true.

ParameterTypeDescription
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.
footerScriptStringFooter format script.

setEvenHeader(section, headerScript)

Sets a script formatting the even page header of an Excel file. Only effect in Excel 2007 when IsHFDiffOddEven is true.

ParameterTypeDescription
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.
headerScriptStringHeader format script.

setFirstPageFooter(section, footerScript)

Sets a script formatting the first page footer of an Excel file.

ParameterTypeDescription
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.
footerScriptStringFooter format script.

setFirstPageHeader(section, headerScript)

Sets a script formatting the first page header of an Excel file. Only effect in Excel 2007 when IsHFDiffFirst is true.

ParameterTypeDescription
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.
headerScriptStringHeader format script.

setFirstPageNumber()

Represents the first page number that will be used when this sheet is printed.

setFitToPages(wide, tall)

Sets the number of pages the worksheet will be scaled to when it’s printed.

ParameterTypeDescription
wideNumberPages wide.
tallNumberPages tall.

setFitToPagesTall()

Represents the number of pages tall the worksheet will be scaled to when it’s printed. The default value is 1. You have to set FitToPagesWide as zero if you want to fit all rows on one page.

setFitToPagesWide()

Represents the number of pages wide the worksheet will be scaled to when it’s printed. The default value is 1. You have to set FitToPagesTall as zero if you want to fit all columns on one page.

setFooter(section, footerScript)

Sets a script formatting the footer of an Excel file. Script commands:CommandDescription&PCurrent page number &NPage count &DCurrent date &TCurrent time&ASheet name&FFile name without path&" “Font name, for example: &“Arial”&” , “Font name and font style, for example: &“Arial,Bold”& Font size. If this command is followed by a plain number to be printed in the header, it will be separated from the font height with a space character.&K Font color, for example(RED): &KFF0000&GImage script For example: “&Arial,Bold&8Footer Note”

ParameterTypeDescription
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.
footerScriptStringFooter format script.

setFooterMargin()

Represents the distance from the bottom of the page to the footer, in unit of centimeters.

setFooterMarginInch()

Represents the distance from the bottom of the page to the footer, in unit of inches.

setFooterPicture(section, footerPicture)

Sets an image in the footer of a worksheet.

ParameterTypeDescription
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.
footerPictureArray of byteImage data.

Returns: Picture — Picture Returns Picture object.

setHFAlignMargins()

Indicates whether header and footer margins are aligned with the page margins. If this property is true, the left header and footer will be aligned with the left margin, and the right header and footer will be aligned with the right margin. This option is enabled by default.

setHFDiffFirst()

True means that the header/footer of the first page is different with other pages.

setHFDiffOddEven()

True means that the header/footer of the odd pages is different with odd pages.

setHFScaleWithDoc()

Indicates whether header and footer are scaled with document scaling. Only applies for Excel 2007.

setHeader(section, headerScript)

Sets a script formatting the header of an Excel file. Script commands:CommandDescription&PCurrent page number &NPage count &DCurrent date &TCurrent time&ASheet name&FFile name without path&” “Font name, for example: &“Arial”&” , “Font name and font style, for example: &“Arial,Bold”& Font size. If this command is followed by a plain number to be printed in the header, it will be separated from the font height with a space character.&K Font color, for example(RED): &KFF0000&GImage script For example: “&Arial,Bold&8Header Note”

ParameterTypeDescription
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.
headerScriptStringHeader format script.

setHeaderMargin()

Represents the distance from the top of the page to the header, in unit of centimeters.

setHeaderMarginInch()

Represents the distance from the top of the page to the header, in unit of inches.

setHeaderPicture(section, headerPicture)

Sets an image in the header of a worksheet.

ParameterTypeDescription
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.
headerPictureArray of byteImage data.

Returns: Picture — Picture Returns Picture object.

setLeftMargin()

Represents the size of the left margin, in unit of centimeters.

setLeftMarginInch()

Represents the size of the left margin, in unit of inches.

setOrder()

Represents the order that Microsoft Excel uses to number pages when printing a large worksheet. The value of the property is PrintOrderType integer constant.

setOrientation()

Represents page print orientation. The value of the property is PageOrientationType integer constant.

setPaperSize()

Represents the size of the paper. The value of the property is PaperSizeType integer constant.

setPercentScale()

If this property is False, the FitToPagesWide and FitToPagesTall properties control how the worksheet is scaled.

setPicture(isFirst, isEven, isHeader, section, imageData)

Sets an image in the header/footer of a worksheet.

ParameterTypeDescription
isFirstbooleanIndicates whether setting the picture of first page header/footer.
isEvenbooleanIndicates whether setting the picture of even page header/footer.
isHeaderbooleanIndicates whether setting the picture of header/footer.
sectionNumber0: Left Section, 1: Center Section, 2: Right Section.
imageDataArray of byteImage data.

Returns: Picture — Picture Returns Picture object.

setPrintArea()

Represents the range to be printed.

setPrintComments()

Represents the way comments are printed with the sheet. The value of the property is PrintCommentsType integer constant.

setPrintCopies()

Get and sets number of copies to print.

setPrintDraft()

Represents if the sheet will be printed without graphics.

setPrintErrors()

Specifies the type of print error displayed. The value of the property is PrintErrorsType integer constant.

setPrintGridlines()

Represents if cell gridlines are printed on the page.

setPrintHeadings()

Represents if row and column headings are printed with this page.

setPrintQuality()

Represents the print quality.

setPrintTitleColumns()

Represents the columns that contain the cells to be repeated on the left side of each page.

setPrintTitleRows()

Represents the rows that contain the cells to be repeated at the top of each page.

setPrinterSettings()

Gets and sets the settings of the default printer.

setRightMargin()

Represents the size of the right margin, in unit of centimeters.

setRightMarginInch()

Represents the size of the right margin, in unit of inches.

setTopMargin()

Represents the size of the top margin, in unit of centimeters.

setTopMarginInch()

Represents the size of the top margin, in unit of inches.

setZoom()

Represents the scaling factor in percent. It should be between 10 and 400.