com.aspose.cells
Class PageSetup

java.lang.Object
    extended by com.aspose.cells.PageSetup

public class PageSetup 
extends java.lang.Object

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

Example:

sheet.getPageSetup().setPrintArea("D1:K13");
sheet.getPageSetup().setPrintTitleRows("$5:$7");
sheet.getPageSetup().setPrintTitleColumns("$A:$B");

Property Getters/Setters Summary
booleangetBlackAndWhite()
voidsetBlackAndWhite(boolean value)
           Represents if elements of the document will be printed in black and white.
doublegetBottomMargin()
voidsetBottomMargin(double value)
           Represents the size of the bottom margin, in unit of centimeters.
doublegetBottomMarginInch()
voidsetBottomMarginInch(double value)
           Represents the size of the bottom margin, in unit of inches.
booleangetCenterHorizontally()
voidsetCenterHorizontally(boolean value)
           Represent if the sheet is printed centered horizontally.
booleangetCenterVertically()
voidsetCenterVertically(boolean value)
           Represent if the sheet is printed centered vertically.
booleangetDraft()
voidsetDraft(boolean value)
           Represents if the sheet will be printed without graphics.
intgetFirstPageNumber()
voidsetFirstPageNumber(int value)
           Represents the first page number that will be used when this sheet is printed.
intgetFitToPagesTall()
voidsetFitToPagesTall(int value)
           Represents the number of pages tall the worksheet will be scaled to when it's printed.
intgetFitToPagesWide()
voidsetFitToPagesWide(int value)
           Represents the number of pages wide the worksheet will be scaled to when it's printed.
doublegetFooterMargin()
voidsetFooterMargin(double value)
           Represents the distance from the bottom of the page to the footer, in unit of centimeters.
doublegetFooterMarginInch()
voidsetFooterMarginInch(double value)
           Represents the distance from the bottom of the page to the footer, in unit of inches.
doublegetHeaderMargin()
voidsetHeaderMargin(double value)
           Represents the distance from the top of the page to the header, in unit of centimeters.
doublegetHeaderMarginInch()
voidsetHeaderMarginInch(double value)
           Represents the distance from the top of the page to the header, in unit of inches.
booleanisAutoFirstPageNumber()
voidsetAutoFirstPageNumber(boolean value)
           Indicates whether the first the page number is automatically assigned.
booleanisHFAlignMargins()
voidsetHFAlignMargins(boolean value)
           Indicates whether header and footer margins are aligned with the page margins. Only applies for Excel 2007.
booleanisHFDiffFirst()
voidsetHFDiffFirst(boolean value)
           True means that the header/footer of the first page is different with other pages.
booleanisHFDiffOddEven()
voidsetHFDiffOddEven(boolean value)
           True means that the header/footer of the odd pages is different with odd pages.
booleanisHFScaleWithDoc()
voidsetHFScaleWithDoc(boolean value)
           Indicates whether header and footer are scaled with document scaling. Only applies for Excel 2007.
booleanisPercentScale()
voidsetPercentScale(boolean value)
           If this property is False, the FitToPagesWide and FitToPagesTall properties control how the worksheet is scaled.
doublegetLeftMargin()
voidsetLeftMargin(double value)
           Represents the size of the left margin, in unit of centimeters.
doublegetLeftMarginInch()
voidsetLeftMarginInch(double value)
           Represents the size of the left margin, in unit of inches.
intgetOrder()
voidsetOrder(int 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.
intgetOrientation()
voidsetOrientation(int value)
           Represents page print orientation. The value of the property is PageOrientationType integer constant.
intgetPaperSize()
voidsetPaperSize(int value)
           Represents the size of the paper. The value of the property is PaperSizeType integer constant.
java.lang.StringgetPrintArea()
voidsetPrintArea(java.lang.String value)
           Represents the range to be printed.
intgetPrintComments()
voidsetPrintComments(int value)
           Represents the way comments are printed with the sheet. The value of the property is PrintCommentsType integer constant.
intgetPrintCopies()
voidsetPrintCopies(int value)
           Get and sets number of copies to print.
booleangetPrintDraft()
voidsetPrintDraft(boolean value)
           Represents if the sheet will be printed without graphics.
intgetPrintErrors()
voidsetPrintErrors(int value)
           Specifies the type of print error displayed. The value of the property is PrintErrorsType integer constant.
booleangetPrintGridlines()
voidsetPrintGridlines(boolean value)
           Represents if cell gridlines are printed on the page.
booleangetPrintHeadings()
voidsetPrintHeadings(boolean value)
           Represents if row and column headings are printed with this page.
intgetPrintQuality()
voidsetPrintQuality(int value)
           Represents the print quality.
java.lang.StringgetPrintTitleColumns()
voidsetPrintTitleColumns(java.lang.String value)
           Represents the columns that contain the cells to be repeated on the left side of each page.
java.lang.StringgetPrintTitleRows()
voidsetPrintTitleRows(java.lang.String value)
           Represents the rows that contain the cells to be repeated at the top of each page.
doublegetRightMargin()
voidsetRightMargin(double value)
           Represents the size of the right margin, in unit of centimeters.
doublegetRightMarginInch()
voidsetRightMarginInch(double value)
           Represents the size of the right margin, in unit of inches.
doublegetTopMargin()
voidsetTopMargin(double value)
           Represents the size of the top margin, in unit of centimeters.
doublegetTopMarginInch()
voidsetTopMarginInch(double value)
           Represents the size of the top margin, in unit of inches.
intgetZoom()
voidsetZoom(int value)
           Represents the scaling factor in percent. It should be between 10 and 400.
 
Method Summary
voidclearHeaderFooter()
           Clears header and footer setting.
com.aspose.cells.HeaderFooterCommand[]getCommands(java.lang.String headerFooterScript)
           Gets all commands of header or footer.
java.lang.StringgetEvenFooter(int section)
           Gets a script formatting the even footer of an Excel file.
java.lang.StringgetEvenHeader(int section)
           Gets a script formatting the even header of an Excel file.
java.lang.StringgetFirstPageFooter(int section)
           Gets a script formatting the first page footer of an Excel file.
java.lang.StringgetFirstPageHeader(int section)
           Gets a script formatting the first page header of an Excel file.
java.lang.StringgetFooter(int section)
           Gets a script formatting the footer of an Excel file.
java.lang.StringgetHeader(int section)
           Gets a script formatting the header of an Excel file.
PicturegetPicture(boolean isHeader, int section)
           Gets the Picture object of the header / footer.
voidsetEvenFooter(int section, java.lang.String footerScript)
           Sets a script formatting the even page footer of an Excel file. Only effect in Excel 2007 when IsHFDiffOddEven is true.
voidsetEvenHeader(int section, java.lang.String headerScript)
           Sets a script formatting the even page header of an Excel file. Only effect in Excel 2007 when IsHFDiffOddEven is true.
voidsetFirstPageFooter(int section, java.lang.String footerScript)
           Sets a script formatting the first page footer of an Excel file.
voidsetFirstPageHeader(int section, java.lang.String headerScript)
           Sets a script formatting the first page header of an Excel file. Only effect in Excel 2007 when IsHFDiffFirst is true.
voidsetFooter(int section, java.lang.String footerScript)
           Sets a script formatting the footer of an Excel file.
PicturesetFooterPicture(int section, byte[] footerPicture)
           Sets an image in the footer of a worksheet.
voidsetHeader(int section, java.lang.String headerScript)
           Sets a script formatting the header of an Excel file.
PicturesetHeaderPicture(int section, byte[] headerPicture)
           Sets an image in the header of a worksheet.
 

Property Getters/Setters Detail

getPrintTitleColumns/setPrintTitleColumns

public java.lang.String getPrintTitleColumns() / public void setPrintTitleColumns(java.lang.String value)
Represents the columns that contain the cells to be repeated on the left side of each page.

Example:

cells.getPageSetup().setPrintTitleColumns("$A:$A");

getPrintTitleRows/setPrintTitleRows

public java.lang.String getPrintTitleRows() / public void setPrintTitleRows(java.lang.String value)
Represents the rows that contain the cells to be repeated at the top of each page.

Example:

cells.getPageSetup().setPrintTitleRows("$1:$1");

getBlackAndWhite/setBlackAndWhite

public boolean getBlackAndWhite() / public void setBlackAndWhite(boolean value)
Represents if elements of the document will be printed in black and white.

getCenterHorizontally/setCenterHorizontally

public boolean getCenterHorizontally() / public void setCenterHorizontally(boolean value)
Represent if the sheet is printed centered horizontally.

getCenterVertically/setCenterVertically

public boolean getCenterVertically() / public void setCenterVertically(boolean value)
Represent if the sheet is printed centered vertically.

getDraft/setDraft

public boolean getDraft() / public void setDraft(boolean value)
Represents if the sheet will be printed without graphics. NOTE: This member is now obsolete. Instead, please use PageSetup.PrintDraft property. This property will be removed 12 months later since June 2010. Aspose apologizes for any inconvenience you may have experienced.

getPrintDraft/setPrintDraft

public boolean getPrintDraft() / public void setPrintDraft(boolean value)
Represents if the sheet will be printed without graphics.

getFooterMargin/setFooterMargin

public double getFooterMargin() / public void setFooterMargin(double value)
Represents the distance from the bottom of the page to the footer, in unit of centimeters.

getFooterMarginInch/setFooterMarginInch

public double getFooterMarginInch() / public void setFooterMarginInch(double value)
Represents the distance from the bottom of the page to the footer, in unit of inches.

getHeaderMargin/setHeaderMargin

public double getHeaderMargin() / public void setHeaderMargin(double value)
Represents the distance from the top of the page to the header, in unit of centimeters.

getHeaderMarginInch/setHeaderMarginInch

public double getHeaderMarginInch() / public void setHeaderMarginInch(double value)
Represents the distance from the top of the page to the header, in unit of inches.

getLeftMargin/setLeftMargin

public double getLeftMargin() / public void setLeftMargin(double value)
Represents the size of the left margin, in unit of centimeters.

getLeftMarginInch/setLeftMarginInch

public double getLeftMarginInch() / public void setLeftMarginInch(double value)
Represents the size of the left margin, in unit of inches.

getRightMargin/setRightMargin

public double getRightMargin() / public void setRightMargin(double value)
Represents the size of the right margin, in unit of centimeters.

getRightMarginInch/setRightMarginInch

public double getRightMarginInch() / public void setRightMarginInch(double value)
Represents the size of the right margin, in unit of inches.

getTopMargin/setTopMargin

public double getTopMargin() / public void setTopMargin(double value)
Represents the size of the top margin, in unit of centimeters.

getTopMarginInch/setTopMarginInch

public double getTopMarginInch() / public void setTopMarginInch(double value)
Represents the size of the top margin, in unit of inches.

getBottomMargin/setBottomMargin

public double getBottomMargin() / public void setBottomMargin(double value)
Represents the size of the bottom margin, in unit of centimeters.

getBottomMarginInch/setBottomMarginInch

public double getBottomMarginInch() / public void setBottomMarginInch(double value)
Represents the size of the bottom margin, in unit of inches.

getFirstPageNumber/setFirstPageNumber

public int getFirstPageNumber() / public void setFirstPageNumber(int value)
Represents the first page number that will be used when this sheet is printed.

getFitToPagesTall/setFitToPagesTall

public int getFitToPagesTall() / public void setFitToPagesTall(int value)
Represents the number of pages tall the worksheet will be scaled to when it's printed.

getFitToPagesWide/setFitToPagesWide

public int getFitToPagesWide() / public void setFitToPagesWide(int value)
Represents the number of pages wide the worksheet will be scaled to when it's printed.

isPercentScale/setPercentScale

public boolean isPercentScale() / public void setPercentScale(boolean value)
If this property is False, the FitToPagesWide and FitToPagesTall properties control how the worksheet is scaled.

getOrder/setOrder

public int getOrder() / public void setOrder(int 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.

getPaperSize/setPaperSize

public int getPaperSize() / public void setPaperSize(int value)
Represents the size of the paper. The value of the property is PaperSizeType integer constant.

getOrientation/setOrientation

public int getOrientation() / public void setOrientation(int value)
Represents page print orientation. The value of the property is PageOrientationType integer constant.

getPrintComments/setPrintComments

public int getPrintComments() / public void setPrintComments(int value)
Represents the way comments are printed with the sheet. The value of the property is PrintCommentsType integer constant.

getPrintErrors/setPrintErrors

public int getPrintErrors() / public void setPrintErrors(int value)
Specifies the type of print error displayed. The value of the property is PrintErrorsType integer constant.

getPrintHeadings/setPrintHeadings

public boolean getPrintHeadings() / public void setPrintHeadings(boolean value)
Represents if row and column headings are printed with this page.

getPrintGridlines/setPrintGridlines

public boolean getPrintGridlines() / public void setPrintGridlines(boolean value)
Represents if cell gridlines are printed on the page.

getZoom/setZoom

public int getZoom() / public void setZoom(int value)
Represents the scaling factor in percent. It should be between 10 and 400.

isAutoFirstPageNumber/setAutoFirstPageNumber

public boolean isAutoFirstPageNumber() / public void setAutoFirstPageNumber(boolean value)
Indicates whether the first the page number is automatically assigned.

getPrintQuality/setPrintQuality

public int getPrintQuality() / public void setPrintQuality(int value)
Represents the print quality.

getPrintCopies/setPrintCopies

public int getPrintCopies() / public void setPrintCopies(int value)
Get and sets number of copies to print.

isHFDiffOddEven/setHFDiffOddEven

public boolean isHFDiffOddEven() / public void setHFDiffOddEven(boolean value)
True means that the header/footer of the odd pages is different with odd pages.

isHFDiffFirst/setHFDiffFirst

public boolean isHFDiffFirst() / public void setHFDiffFirst(boolean value)
True means that the header/footer of the first page is different with other pages.

isHFScaleWithDoc/setHFScaleWithDoc

public boolean isHFScaleWithDoc() / public void setHFScaleWithDoc(boolean value)
Indicates whether header and footer are scaled with document scaling. Only applies for Excel 2007.

isHFAlignMargins/setHFAlignMargins

public boolean isHFAlignMargins() / public void setHFAlignMargins(boolean value)
Indicates whether header and footer margins are aligned with the page margins. Only applies for Excel 2007.

getPrintArea/setPrintArea

public java.lang.String getPrintArea() / public void setPrintArea(java.lang.String value)
Represents the range to be printed.

Method Detail

setHeaderPicture

public Picture setHeaderPicture(int section, byte[] headerPicture)
                        throws java.lang.Exception
Sets an image in the header of a worksheet.
Parameters:
section -

0:Left Section.

1:Center Section

2:Right Section

headerPicture - Image data.
Returns:
Returns Picture object.

setFooterPicture

public Picture setFooterPicture(int section, byte[] footerPicture)
                        throws java.lang.Exception
Sets an image in the footer of a worksheet.
Parameters:
section -

0:Left Section.

1:Center Section

2:Right Section

footerPicture - Image data.
Returns:
Returns Picture object.

getPicture

public Picture getPicture(boolean isHeader, int section)
Gets the Picture object of the header / footer.
Parameters:
isHeader - Indicates whether it is in the header or footer.
section -

0:Left Section.

1:Center Section

2:Right Section

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

clearHeaderFooter

public void clearHeaderFooter()
Clears header and footer setting.

getHeader

public java.lang.String getHeader(int section)
Gets a script formatting the header of an Excel file.
Parameters:
section -

0:Left Section.

1:Center Section

2:Right Section


getCommands

public com.aspose.cells.HeaderFooterCommand[] getCommands(java.lang.String headerFooterScript)
Gets all commands of header or footer.
Parameters:
headerFooterScript - The header/footer script
Returns:
Returns all commands of header or footer.

getFooter

public java.lang.String getFooter(int section)
Gets a script formatting the footer of an Excel file.
Parameters:
section -

0:Left Section.

1:Center Section

2:Right Section


setHeader

public void setHeader(int section, java.lang.String headerScript)
Sets a script formatting the header of an Excel file.

Script commands:

Command Description 
&PCurrent page number 
&NPage count 
&DCurrent date 
&TCurrent time
&ASheet name
&FFile name without path
&"<FontName>"Font name, for exampe: &"Arial"
&"<FontName>, <FontStyle>"Font name and font style, for exampe: &"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 exampe(RED): &FF0000
&GImage script
For example: "&Arial,Bold&8Header Note"
Parameters:
section -

0:Left Section.

1:Center Section

2:Right Section

headerScript - Header format script.

setFooter

public void setFooter(int section, java.lang.String footerScript)
Sets a script formatting the footer of an Excel file.

Script commands:

Command Description 
&PCurrent page number 
&NPage count 
&DCurrent date 
&TCurrent time
&ASheet name
&FFile name without path
&"<FontName>"Font name, for exampe: &"Arial"
&"<FontName>, <FontStyle>"Font name and font style, for exampe: &"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.
&GImage script
For example: "&Arial,Bold&8Footer Note"
Parameters:
section -

0:Left Section.

1:Center Section

2:Right Section

footerScript - Footer format script.

setEvenHeader

public void setEvenHeader(int section, java.lang.String headerScript)
Sets a script formatting the even page header of an Excel file. Only effect in Excel 2007 when IsHFDiffOddEven is true.
Parameters:
section -

0:Left Section.

1:Center Section

2:Right Section

headerScript - Header format script.

getEvenHeader

public java.lang.String getEvenHeader(int section)
Gets a script formatting the even header of an Excel file.
Parameters:
section -

0:Left Section.

1:Center Section

2:Right Section


setEvenFooter

public void setEvenFooter(int section, java.lang.String footerScript)
Sets a script formatting the even page footer of an Excel file. Only effect in Excel 2007 when IsHFDiffOddEven is true.
Parameters:
section -

0:Left Section.

1:Center Section

2:Right Section

footerScript - Footer format script.

getEvenFooter

public java.lang.String getEvenFooter(int section)
Gets a script formatting the even footer of an Excel file.
Parameters:
section -

0:Left Section.

1:Center Section

2:Right Section


setFirstPageHeader

public void setFirstPageHeader(int section, java.lang.String headerScript)
Sets a script formatting the first page header of an Excel file. Only effect in Excel 2007 when IsHFDiffFirst is true.
Parameters:
section -

0:Left Section.

1:Center Section

2:Right Section

headerScript - Header format script.

getFirstPageHeader

public java.lang.String getFirstPageHeader(int section)
Gets a script formatting the first page header of an Excel file.
Parameters:
section -

0:Left Section.

1:Center Section

2:Right Section


setFirstPageFooter

public void setFirstPageFooter(int section, java.lang.String footerScript)
Sets a script formatting the first page footer of an Excel file.
Parameters:
section -

0:Left Section.

1:Center Section

2:Right Section

footerScript - Footer format script.

getFirstPageFooter

public java.lang.String getFirstPageFooter(int section)
Gets a script formatting the first page footer of an Excel file.
Parameters:
section -

0:Left Section.

1:Center Section

2:Right Section


See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.