Methods

Methods

clearHeaderFooter()

Clears header and footer setting.

copy(source, copyOptions)

Copies the setting of the page setup.

Parameters

Name Type Optional Description

source

PageSetup

 

The source.

copyOptions

CopyOptions

 

The copy options.

customPaperSize(width, height)

Sets the custom paper size, in unit of inches.

Parameters

Name Type Optional Description

width

Number

 

The width of the paper.

height

Number

 

The 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) → Array of HeaderFooterCommand

Gets all commands of header or footer.

Parameter

Name Type Optional Description

headerFooterScript

String

 

The header/footer script

Returns

Array of HeaderFooterCommand Returns all commands of header or footer.

getEvenFooter(section)

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

Parameter

Name Type Optional Description

section

Number

 

0: Left Section, 1: Center Section, 2: Right Section.

getEvenHeader(section)

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

Parameter

Name Type Optional Description

section

Number

 

0: Left Section, 1: Center Section, 2: Right Section.

getFirstPageFooter(section)

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

Parameter

Name Type Optional Description

section

Number

 

0: Left Section, 1: Center Section, 2: Right Section.

getFirstPageHeader(section)

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

Parameter

Name Type Optional Description

section

Number

 

0: 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.

Parameter

Name Type Optional Description

section

Number

 

0: 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.

Parameter

Name Type Optional Description

section

Number

 

0: 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) → Picture

Gets the Picture object of the header / footer.

Parameters

Name Type Optional Description

isHeader

boolean

 

Indicates whether it is in the header or footer.

section

Number

 

0: Left Section, 1: Center Section, 2: Right Section.

Returns

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

getPicture(isFirst, isEven, isHeader, section) → Picture

Gets the Picture object of the header / footer.

Parameters

Name Type Optional Description

isFirst

boolean

 

Indicates whether getting the picture of first page header/footer.

isEven

boolean

 

Indicates whether getting the picture of even page header/footer.

isHeader

boolean

 

Indicates whether getting the picture of header/footer.

section

Number

 

0: Left Section, 1: Center Section, 2: Right Section.

Returns

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.

Parameters

Name Type Optional Description

section

Number

 

0: Left Section, 1: Center Section, 2: Right Section.

footerScript

String

 

Footer 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.

Parameters

Name Type Optional Description

section

Number

 

0: Left Section, 1: Center Section, 2: Right Section.

headerScript

String

 

Header format script.

setFirstPageFooter(section, footerScript)

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

Parameters

Name Type Optional Description

section

Number

 

0: Left Section, 1: Center Section, 2: Right Section.

footerScript

String

 

Footer 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.

Parameters

Name Type Optional Description

section

Number

 

0: Left Section, 1: Center Section, 2: Right Section.

headerScript

String

 

Header 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.

Parameters

Name Type Optional Description

wide

Number

 

Pages wide.

tall

Number

 

Pages 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.&KFont color, for example(RED): &KFF0000&GImage script For example: "&Arial,Bold&8Footer Note"

Parameters

Name Type Optional Description

section

Number

 

0: Left Section, 1: Center Section, 2: Right Section.

footerScript

String

 

Footer 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) → Picture

Sets an image in the footer of a worksheet.

Parameters

Name Type Optional Description

section

Number

 

0: Left Section, 1: Center Section, 2: Right Section.

footerPicture

Array of byte

 

Image data.

Returns

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.&KFont color, for example(RED): &KFF0000&GImage script For example: "&Arial,Bold&8Header Note"

Parameters

Name Type Optional Description

section

Number

 

0: Left Section, 1: Center Section, 2: Right Section.

headerScript

String

 

Header 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) → Picture

Sets an image in the header of a worksheet.

Parameters

Name Type Optional Description

section

Number

 

0: Left Section, 1: Center Section, 2: Right Section.

headerPicture

Array of byte

 

Image data.

Returns

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) → Picture

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

Parameters

Name Type Optional Description

isFirst

boolean

 

Indicates whether setting the picture of first page header/footer.

isEven

boolean

 

Indicates whether setting the picture of even page header/footer.

isHeader

boolean

 

Indicates whether setting the picture of header/footer.

section

Number

 

0: Left Section, 1: Center Section, 2: Right Section.

imageData

Array of byte

 

Image data.

Returns

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.