Example:
workbook = Workbook() sheet = workbook.getWorksheets().get(0) sheet.getPageSetup().setPrintArea("D1:K13") sheet.getPageSetup().setPrintTitleRows("$5:$7") sheet.getPageSetup().setPrintTitleColumns("$A:$B")
Property Getters/Setters Summary | ||
---|---|---|
method | getBlackAndWhite() | |
method | setBlackAndWhite(value) | |
Represents if elements of the document will be printed in black and white. | ||
method | getBottomMargin() | |
method | setBottomMargin(value) | |
Represents the size of the bottom margin, in unit of centimeters. | ||
method | getBottomMarginInch() | |
method | setBottomMarginInch(value) | |
Represents the size of the bottom margin, in unit of inches. | ||
method | getCenterHorizontally() | |
method | setCenterHorizontally(value) | |
Represent if the sheet is printed centered horizontally. | ||
method | getCenterVertically() | |
method | setCenterVertically(value) | |
Represent if the sheet is printed centered vertically. | ||
method | getFirstPageNumber() | |
method | setFirstPageNumber(value) | |
Represents the first page number that will be used when this sheet is printed. | ||
method | getFitToPagesTall() | |
method | setFitToPagesTall(value) | |
Represents the number of pages tall the worksheet will be scaled to when it's printed. The default value is 1. | ||
method | getFitToPagesWide() | |
method | setFitToPagesWide(value) | |
Represents the number of pages wide the worksheet will be scaled to when it's printed. The default value is 1. | ||
method | getFooterMargin() | |
method | setFooterMargin(value) | |
Represents the distance from the bottom of the page to the footer, in unit of centimeters. | ||
method | getFooterMarginInch() | |
method | setFooterMarginInch(value) | |
Represents the distance from the bottom of the page to the footer, in unit of inches. | ||
method | getHeaderMargin() | |
method | setHeaderMargin(value) | |
Represents the distance from the top of the page to the header, in unit of centimeters. | ||
method | getHeaderMarginInch() | |
method | setHeaderMarginInch(value) | |
Represents the distance from the top of the page to the header, in unit of inches. | ||
method | isAutoFirstPageNumber() | |
method | setAutoFirstPageNumber(value) | |
Indicates whether the first the page number is automatically assigned. | ||
method | isAutomaticPaperSize() | |
Indicates whether the paper size is automatic.
|
||
method | isHFAlignMargins() | |
method | setHFAlignMargins(value) | |
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. | ||
method | isHFDiffFirst() | |
method | setHFDiffFirst(value) | |
True means that the header/footer of the first page is different with other pages. | ||
method | isHFDiffOddEven() | |
method | setHFDiffOddEven(value) | |
True means that the header/footer of the odd pages is different with odd pages. | ||
method | isHFScaleWithDoc() | |
method | setHFScaleWithDoc(value) | |
Indicates whether header and footer are scaled with document scaling. Only applies for Excel 2007. | ||
method | isPercentScale() | |
method | setPercentScale(value) | |
If this property is False, the FitToPagesWide and FitToPagesTall properties control how the worksheet is scaled. | ||
method | getLeftMargin() | |
method | setLeftMargin(value) | |
Represents the size of the left margin, in unit of centimeters. | ||
method | getLeftMarginInch() | |
method | setLeftMarginInch(value) | |
Represents the size of the left margin, in unit of inches. | ||
method | getODSPageBackground() | |
Gets the background of ODS.
|
||
method | getOrder() | |
method | setOrder(value) | |
Represents the order that Microsoft Excel uses to number pages when printing a large worksheet. The value of the property is PrintOrderType integer constant. | ||
method | getOrientation() | |
method | setOrientation(value) | |
Represents page print orientation. The value of the property is PageOrientationType integer constant. | ||
method | getPaperHeight() | |
Gets the height of the paper in unit of inches , considered page orientation.
|
||
method | getPaperSize() | |
method | setPaperSize(value) | |
Represents the size of the paper. The value of the property is PaperSizeType integer constant. | ||
method | getPaperWidth() | |
Gets the width of the paper in unit of inches, considered page orientation.
|
||
method | getPrintArea() | |
method | setPrintArea(value) | |
Represents the range to be printed. | ||
method | getPrintComments() | |
method | setPrintComments(value) | |
Represents the way comments are printed with the sheet. The value of the property is PrintCommentsType integer constant. | ||
method | getPrintCopies() | |
method | setPrintCopies(value) | |
Get and sets number of copies to print. | ||
method | getPrintDraft() | |
method | setPrintDraft(value) | |
Represents if the sheet will be printed without graphics. | ||
method | getPrintErrors() | |
method | setPrintErrors(value) | |
Specifies the type of print error displayed. The value of the property is PrintErrorsType integer constant. | ||
method | getPrinterSettings() | |
method | setPrinterSettings(value) | |
Gets and sets the settings of the default printer. | ||
method | getPrintGridlines() | |
method | setPrintGridlines(value) | |
Represents if cell gridlines are printed on the page. | ||
method | getPrintHeadings() | |
method | setPrintHeadings(value) | |
Represents if row and column headings are printed with this page. | ||
method | getPrintQuality() | |
method | setPrintQuality(value) | |
Represents the print quality. | ||
method | getPrintTitleColumns() | |
method | setPrintTitleColumns(value) | |
Represents the columns that contain the cells to be repeated on the left side of each page. | ||
method | getPrintTitleRows() | |
method | setPrintTitleRows(value) | |
Represents the rows that contain the cells to be repeated at the top of each page. | ||
method | getRightMargin() | |
method | setRightMargin(value) | |
Represents the size of the right margin, in unit of centimeters. | ||
method | getRightMarginInch() | |
method | setRightMarginInch(value) | |
Represents the size of the right margin, in unit of inches. | ||
method | getTopMargin() | |
method | setTopMargin(value) | |
Represents the size of the top margin, in unit of centimeters. | ||
method | getTopMarginInch() | |
method | setTopMarginInch(value) | |
Represents the size of the top margin, in unit of inches. | ||
method | getZoom() | |
method | setZoom(value) | |
Represents the scaling factor in percent. It should be between 10 and 400. |
Method Summary | ||
---|---|---|
method | clearHeaderFooter() | |
Clears header and footer setting.
|
||
method | copy(source, copyOptions) | |
Copies the setting of the page setup.
|
||
method | customPaperSize(width, height) | |
Sets the custom paper size, in unit of inches.
|
||
method | getCommands(headerFooterScript) | |
Gets all commands of header or footer.
|
||
method | getEvenFooter(section) | |
Gets a script formatting the even footer of an Excel file.
|
||
method | getEvenHeader(section) | |
Gets a script formatting the even header of an Excel file.
|
||
method | getFirstPageFooter(section) | |
Gets a script formatting the first page footer of an Excel file.
|
||
method | getFirstPageHeader(section) | |
Gets a script formatting the first page header of an Excel file.
|
||
method | getFooter(section) | |
Gets a script formatting the footer of an Excel file.
|
||
method | getHeader(section) | |
Gets a script formatting the header of an Excel file.
|
||
method | getPicture(isFirst, isEven, isHeader, section) | |
Gets the |
||
method | getPicture(isHeader, section) | |
Gets the |
||
method | setEvenFooter(section, footerScript) | |
Sets a script formatting the even page footer of an Excel file.
Only effect in Excel 2007 when IsHFDiffOddEven is true.
|
||
method | setEvenHeader(section, headerScript) | |
Sets a script formatting the even page header of an Excel file.
Only effect in Excel 2007 when IsHFDiffOddEven is true.
|
||
method | setFirstPageFooter(section, footerScript) | |
Sets a script formatting the first page footer of an Excel file.
|
||
method | setFirstPageHeader(section, headerScript) | |
Sets a script formatting the first page header of an Excel file.
Only effect in Excel 2007 when IsHFDiffFirst is true.
|
||
method | setFitToPages(wide, tall) | |
Sets the number of pages the worksheet will be scaled to when it's printed.
|
||
method | setFooter(section, footerScript) | |
Sets a script formatting the footer of an Excel file.
|
||
method | setFooterPicture(section, footerPicture) | |
Sets an image in the footer of a worksheet.
|
||
method | setHeader(section, headerScript) | |
Sets a script formatting the header of an Excel file.
|
||
method | setHeaderPicture(section, headerPicture) | |
Sets an image in the header of a worksheet.
|
||
method | setPicture(isFirst, isEven, isHeader, section, imageData) | |
Sets an image in the header/footer of a worksheet.
|
OdsPageBackground getODSPageBackground()
String getPrintArea() / setPrintArea(value)
String getPrintTitleColumns() / setPrintTitleColumns(value)
String getPrintTitleRows() / setPrintTitleRows(value)
boolean getBlackAndWhite() / setBlackAndWhite(value)
boolean getCenterHorizontally() / setCenterHorizontally(value)
boolean getCenterVertically() / setCenterVertically(value)
boolean getPrintDraft() / setPrintDraft(value)
float getFooterMargin() / setFooterMargin(value)
float getFooterMarginInch() / setFooterMarginInch(value)
float getHeaderMargin() / setHeaderMargin(value)
float getHeaderMarginInch() / setHeaderMarginInch(value)
byte[] getPrinterSettings() / setPrinterSettings(value)
float getLeftMargin() / setLeftMargin(value)
float getLeftMarginInch() / setLeftMarginInch(value)
float getRightMargin() / setRightMargin(value)
float getRightMarginInch() / setRightMarginInch(value)
float getTopMargin() / setTopMargin(value)
float getTopMarginInch() / setTopMarginInch(value)
float getBottomMargin() / setBottomMargin(value)
float getBottomMarginInch() / setBottomMarginInch(value)
int getFirstPageNumber() / setFirstPageNumber(value)
int getFitToPagesTall() / setFitToPagesTall(value)
int getFitToPagesWide() / setFitToPagesWide(value)
boolean isPercentScale() / setPercentScale(value)
int getOrder() / setOrder(value)
boolean isAutomaticPaperSize()
int getPaperSize() / setPaperSize(value)
float getPaperWidth()
float getPaperHeight()
int getOrientation() / setOrientation(value)
int getPrintComments() / setPrintComments(value)
int getPrintErrors() / setPrintErrors(value)
boolean getPrintHeadings() / setPrintHeadings(value)
boolean getPrintGridlines() / setPrintGridlines(value)
int getZoom() / setZoom(value)
boolean isAutoFirstPageNumber() / setAutoFirstPageNumber(value)
int getPrintQuality() / setPrintQuality(value)
int getPrintCopies() / setPrintCopies(value)
boolean isHFDiffOddEven() / setHFDiffOddEven(value)
boolean isHFDiffFirst() / setHFDiffFirst(value)
boolean isHFScaleWithDoc() / setHFScaleWithDoc(value)
boolean isHFAlignMargins() / setHFAlignMargins(value)
Picture setHeaderPicture(section, headerPicture)
section: int
- 0:Left Section.
1:Center Section
2:Right Section
headerPicture: byte[]
- Image data.Picture setFooterPicture(section, footerPicture)
section: int
- 0:Left Section.
1:Center Section
2:Right Section
footerPicture: byte[]
- Image data.Picture setPicture(isFirst, isEven, isHeader, section, imageData)
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: int
- 0:Left Section.
1:Center Section
2:Right Section
imageData: byte[]
- Image data.Picture getPicture(isHeader, section)
Picture getPicture(isFirst, isEven, isHeader, section)
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: int
- 0:Left Section.
1:Center Section
2:Right Section
copy(source, copyOptions)
source: PageSetup
- The source.copyOptions: CopyOptions
- The copy options.setFitToPages(wide, tall)
wide: int
- Pages wide.tall: int
- Pages tall.customPaperSize(width, height)
width: float
- The width of the paper. height: float
- The height of the paper.clearHeaderFooter()
String getHeader(section)
section: int
- 0:Left Section.
1:Center Section
2:Right Section
HeaderFooterCommand[] getCommands(headerFooterScript)
headerFooterScript: String
- The header/footer scriptString getFooter(section)
section: int
- 0:Left Section.
1:Center Section
2:Right Section
setHeader(section, headerScript)
Script commands:
Command | Description |
&P | Current page number |
&N | Page count |
&D | Current date |
&T | Current time |
&A | Sheet name |
&F | File name without path |
&"<FontName>" | Font name, for example: &"Arial" |
&"<FontName>, <FontStyle>" | Font name and font style, for example: &"Arial,Bold" |
&<FontSize> | 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): &FF0000 |
&G | Image script |
section: int
- 0:Left Section.
1:Center Section
2:Right Section
headerScript: String
- Header format script.setFooter(section, footerScript)
Script commands:
Command | Description |
&P | Current page number |
&N | Page count |
&D | Current date |
&T | Current time |
&A | Sheet name |
&F | File name without path |
&"<FontName>" | Font name, for example: &"Arial" |
&"<FontName>, <FontStyle>" | Font name and font style, for example: &"Arial,Bold" |
&<FontSize> | 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. |
&G | Image script |
section: int
- 0:Left Section.
1:Center Section
2:Right Section
footerScript: String
- Footer format script.setEvenHeader(section, headerScript)
section: int
- 0:Left Section.
1:Center Section
2:Right Section
headerScript: String
- Header format script.String getEvenHeader(section)
section: int
- 0:Left Section.
1:Center Section
2:Right Section
setEvenFooter(section, footerScript)
section: int
- 0:Left Section.
1:Center Section
2:Right Section
footerScript: String
- Footer format script.String getEvenFooter(section)
section: int
- 0:Left Section.
1:Center Section
2:Right Section
setFirstPageHeader(section, headerScript)
section: int
- 0:Left Section.
1:Center Section
2:Right Section
headerScript: String
- Header format script.String getFirstPageHeader(section)
section: int
- 0:Left Section.
1:Center Section
2:Right Section
setFirstPageFooter(section, footerScript)
section: int
- 0:Left Section.
1:Center Section
2:Right Section
footerScript: String
- Footer format script.String getFirstPageFooter(section)
section: int
- 0:Left Section.
1:Center Section
2:Right Section