asposecells.api

Class PageSetup

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

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
methodgetBlackAndWhite()
method
           Represents if elements of the document will be printed in black and white.
methodgetBottomMargin()
method
           Represents the size of the bottom margin, in unit of centimeters.
methodgetBottomMarginInch()
method
           Represents the size of the bottom margin, in unit of inches.
methodgetCenterHorizontally()
method
           Represent if the sheet is printed centered horizontally.
methodgetCenterVertically()
method
           Represent if the sheet is printed centered vertically.
methodgetFirstPageNumber()
method
           Represents the first page number that will be used when this sheet is printed.
methodgetFitToPagesTall()
method
           Represents the number of pages tall the worksheet will be scaled to when it's printed. The default value is 1.
methodgetFitToPagesWide()
method
           Represents the number of pages wide the worksheet will be scaled to when it's printed. The default value is 1.
methodgetFooterMargin()
method
           Represents the distance from the bottom of the page to the footer, in unit of centimeters.
methodgetFooterMarginInch()
method
           Represents the distance from the bottom of the page to the footer, in unit of inches.
methodgetHeaderMargin()
method
           Represents the distance from the top of the page to the header, in unit of centimeters.
methodgetHeaderMarginInch()
method
           Represents the distance from the top of the page to the header, in unit of inches.
methodisAutoFirstPageNumber()
method
           Indicates whether the first the page number is automatically assigned.
methodisAutomaticPaperSize()
Indicates whether the paper size is automatic.
methodisHFAlignMargins()
method
           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.
methodisHFDiffFirst()
method
           True means that the header/footer of the first page is different with other pages.
methodisHFDiffOddEven()
method
           True means that the header/footer of the odd pages is different with odd pages.
methodisHFScaleWithDoc()
method
           Indicates whether header and footer are scaled with document scaling. Only applies for Excel 2007.
methodisPercentScale()
method
           If this property is False, the FitToPagesWide and FitToPagesTall properties control how the worksheet is scaled.
methodgetLeftMargin()
method
           Represents the size of the left margin, in unit of centimeters.
methodgetLeftMarginInch()
method
           Represents the size of the left margin, in unit of inches.
methodgetODSPageBackground()
Gets the background of ODS.
methodgetOrder()
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.
methodgetOrientation()
method
           Represents page print orientation. The value of the property is PageOrientationType integer constant.
methodgetPaperHeight()
Represents the height in inches of the paper, considered page orientation.
methodgetPaperSize()
method
           Represents the size of the paper. The value of the property is PaperSizeType integer constant.
methodgetPaperWidth()
Represents the width in inches of the paper, considered page orientation.
methodgetPrintArea()
method
           Represents the range to be printed.
methodgetPrintComments()
method
           Represents the way comments are printed with the sheet. The value of the property is PrintCommentsType integer constant.
methodgetPrintCopies()
method
           Get and sets number of copies to print.
methodgetPrintDraft()
method
           Represents if the sheet will be printed without graphics.
methodgetPrintErrors()
method
           Specifies the type of print error displayed. The value of the property is PrintErrorsType integer constant.
methodgetPrinterSettings()
method
           Gets and sets the settings of the default printer.
methodgetPrintGridlines()
method
           Represents if cell gridlines are printed on the page.
methodgetPrintHeadings()
method
           Represents if row and column headings are printed with this page.
methodgetPrintQuality()
method
           Represents the print quality.
methodgetPrintTitleColumns()
method
           Represents the columns that contain the cells to be repeated on the left side of each page.
methodgetPrintTitleRows()
method
           Represents the rows that contain the cells to be repeated at the top of each page.
methodgetRightMargin()
method
           Represents the size of the right margin, in unit of centimeters.
methodgetRightMarginInch()
method
           Represents the size of the right margin, in unit of inches.
methodgetTopMargin()
method
           Represents the size of the top margin, in unit of centimeters.
methodgetTopMarginInch()
method
           Represents the size of the top margin, in unit of inches.
methodgetZoom()
method
setZoom(value)
           Represents the scaling factor in percent. It should be between 10 and 400.
 
Method Summary
methodclearHeaderFooter()
Clears header and footer setting.
methodcopy(source, copyOptions)
Copys the setting of the page setup.
methodcustomPaperSize(width, height)
Sets the custom paper size, in unit of inches.
methodgetCommands(headerFooterScript)
Gets all commands of header or footer.
methodgetEvenFooter(section)
Gets a script formatting the even footer of an Excel file.
methodgetEvenHeader(section)
Gets a script formatting the even header of an Excel file.
methodgetFirstPageFooter(section)
Gets a script formatting the first page footer of an Excel file.
methodgetFirstPageHeader(section)
Gets a script formatting the first page header of an Excel file.
methodgetFooter(section)
Gets a script formatting the footer of an Excel file.
methodgetHeader(section)
Gets a script formatting the header of an Excel file.
methodgetPicture(isFirst, isEven, isHeader, section)
Gets the Picture object of the header / footer.
methodgetPicture(isHeader, section)
Gets the Picture object of the header / footer.
methodsetEvenFooter(section, footerScript)
Sets a script formatting the even page footer of an Excel file. Only effect in Excel 2007 when IsHFDiffOddEven is true.
methodsetEvenHeader(section, headerScript)
Sets a script formatting the even page header of an Excel file. Only effect in Excel 2007 when IsHFDiffOddEven is true.
methodsetFirstPageFooter(section, footerScript)
Sets a script formatting the first page footer of an Excel file.
methodsetFirstPageHeader(section, headerScript)
Sets a script formatting the first page header of an Excel file. Only effect in Excel 2007 when IsHFDiffFirst is true.
methodsetFitToPages(wide, tall)
Sets the number of pages the worksheet will be scaled to when it's printed.
methodsetFooter(section, footerScript)
Sets a script formatting the footer of an Excel file.
methodsetFooterPicture(section, footerPicture)
Sets an image in the footer of a worksheet.
methodsetHeader(section, headerScript)
Sets a script formatting the header of an Excel file.
methodsetHeaderPicture(section, headerPicture)
Sets an image in the header of a worksheet.
methodsetPicture(isFirst, isEven, isHeader, section, imageData)
Sets an image in the header/footer of a worksheet.
 

    • Property Getters/Setters Detail

      • getODSPageBackground : OdsPageBackground 

        OdsPageBackground getODSPageBackground()
        
        Gets the background of ODS.
      • getPrintArea/setPrintArea : String 

        String getPrintArea() / setPrintArea(value)
        
        Represents the range to be printed.
      • getPrintTitleColumns/setPrintTitleColumns : String 

        String getPrintTitleColumns() / setPrintTitleColumns(value)
        
        Represents the columns that contain the cells to be repeated on the left side of each page.
      • getPrintTitleRows/setPrintTitleRows : String 

        String getPrintTitleRows() / setPrintTitleRows(value)
        
        Represents the rows that contain the cells to be repeated at the top of each page.
      • getBlackAndWhite/setBlackAndWhite : boolean 

        boolean getBlackAndWhite() / setBlackAndWhite(value)
        
        Represents if elements of the document will be printed in black and white.
      • getCenterHorizontally/setCenterHorizontally : boolean 

        boolean getCenterHorizontally() / setCenterHorizontally(value)
        
        Represent if the sheet is printed centered horizontally.
      • getCenterVertically/setCenterVertically : boolean 

        boolean getCenterVertically() / setCenterVertically(value)
        
        Represent if the sheet is printed centered vertically.
      • getPrintDraft/setPrintDraft : boolean 

        boolean getPrintDraft() / setPrintDraft(value)
        
        Represents if the sheet will be printed without graphics.
      • getFooterMargin/setFooterMargin : float 

        float getFooterMargin() / setFooterMargin(value)
        
        Represents the distance from the bottom of the page to the footer, in unit of centimeters.
      • getFooterMarginInch/setFooterMarginInch : float 

        float getFooterMarginInch() / setFooterMarginInch(value)
        
        Represents the distance from the bottom of the page to the footer, in unit of inches.
      • getHeaderMargin/setHeaderMargin : float 

        float getHeaderMargin() / setHeaderMargin(value)
        
        Represents the distance from the top of the page to the header, in unit of centimeters.
      • getHeaderMarginInch/setHeaderMarginInch : float 

        float getHeaderMarginInch() / setHeaderMarginInch(value)
        
        Represents the distance from the top of the page to the header, in unit of inches.
      • getPrinterSettings/setPrinterSettings : byte[] 

        byte[] getPrinterSettings() / setPrinterSettings(value)
        
        Gets and sets the settings of the default printer.
      • getLeftMargin/setLeftMargin : float 

        float getLeftMargin() / setLeftMargin(value)
        
        Represents the size of the left margin, in unit of centimeters.
      • getLeftMarginInch/setLeftMarginInch : float 

        float getLeftMarginInch() / setLeftMarginInch(value)
        
        Represents the size of the left margin, in unit of inches.
      • getRightMargin/setRightMargin : float 

        float getRightMargin() / setRightMargin(value)
        
        Represents the size of the right margin, in unit of centimeters.
      • getRightMarginInch/setRightMarginInch : float 

        float getRightMarginInch() / setRightMarginInch(value)
        
        Represents the size of the right margin, in unit of inches.
      • getTopMargin/setTopMargin : float 

        float getTopMargin() / setTopMargin(value)
        
        Represents the size of the top margin, in unit of centimeters.
      • getTopMarginInch/setTopMarginInch : float 

        float getTopMarginInch() / setTopMarginInch(value)
        
        Represents the size of the top margin, in unit of inches.
      • getBottomMargin/setBottomMargin : float 

        float getBottomMargin() / setBottomMargin(value)
        
        Represents the size of the bottom margin, in unit of centimeters.
      • getBottomMarginInch/setBottomMarginInch : float 

        float getBottomMarginInch() / setBottomMarginInch(value)
        
        Represents the size of the bottom margin, in unit of inches.
      • getFirstPageNumber/setFirstPageNumber : int 

        int getFirstPageNumber() / setFirstPageNumber(value)
        
        Represents the first page number that will be used when this sheet is printed.
      • getFitToPagesTall/setFitToPagesTall : int 

        int getFitToPagesTall() / setFitToPagesTall(value)
        
        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/setFitToPagesWide : int 

        int getFitToPagesWide() / setFitToPagesWide(value)
        
        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.
      • isPercentScale/setPercentScale : boolean 

        boolean isPercentScale() / setPercentScale(value)
        
        If this property is False, the FitToPagesWide and FitToPagesTall properties control how the worksheet is scaled.
      • getOrder/setOrder : int 

        int getOrder() / 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.
      • isAutomaticPaperSize : boolean 

        boolean isAutomaticPaperSize()
        
        Indicates whether the paper size is automatic.
      • getPaperSize/setPaperSize : int 

        int getPaperSize() / setPaperSize(value)
        
        Represents the size of the paper. The value of the property is PaperSizeType integer constant.
      • getPaperWidth : float 

        float getPaperWidth()
        
        Represents the width in inches of the paper, considered page orientation.
      • getPaperHeight : float 

        float getPaperHeight()
        
        Represents the height in inches of the paper, considered page orientation.
      • getOrientation/setOrientation : int 

        int getOrientation() / setOrientation(value)
        
        Represents page print orientation. The value of the property is PageOrientationType integer constant.
      • getPrintComments/setPrintComments : int 

        int getPrintComments() / setPrintComments(value)
        
        Represents the way comments are printed with the sheet. The value of the property is PrintCommentsType integer constant.
      • getPrintErrors/setPrintErrors : int 

        int getPrintErrors() / setPrintErrors(value)
        
        Specifies the type of print error displayed. The value of the property is PrintErrorsType integer constant.
      • getPrintHeadings/setPrintHeadings : boolean 

        boolean getPrintHeadings() / setPrintHeadings(value)
        
        Represents if row and column headings are printed with this page.
      • getPrintGridlines/setPrintGridlines : boolean 

        boolean getPrintGridlines() / setPrintGridlines(value)
        
        Represents if cell gridlines are printed on the page.
      • getZoom/setZoom : int 

        int getZoom() / setZoom(value)
        
        Represents the scaling factor in percent. It should be between 10 and 400.
      • isAutoFirstPageNumber/setAutoFirstPageNumber : boolean 

        boolean isAutoFirstPageNumber() / setAutoFirstPageNumber(value)
        
        Indicates whether the first the page number is automatically assigned.
      • getPrintQuality/setPrintQuality : int 

        int getPrintQuality() / setPrintQuality(value)
        
        Represents the print quality.
      • getPrintCopies/setPrintCopies : int 

        int getPrintCopies() / setPrintCopies(value)
        
        Get and sets number of copies to print.
      • isHFDiffOddEven/setHFDiffOddEven : boolean 

        boolean isHFDiffOddEven() / setHFDiffOddEven(value)
        
        True means that the header/footer of the odd pages is different with odd pages.
      • isHFDiffFirst/setHFDiffFirst : boolean 

        boolean isHFDiffFirst() / setHFDiffFirst(value)
        
        True means that the header/footer of the first page is different with other pages.
      • isHFScaleWithDoc/setHFScaleWithDoc : boolean 

        boolean isHFScaleWithDoc() / setHFScaleWithDoc(value)
        
        Indicates whether header and footer are scaled with document scaling. Only applies for Excel 2007.
      • isHFAlignMargins/setHFAlignMargins : boolean 

        boolean isHFAlignMargins() / 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 Detail

      • setHeaderPicture

        Picture setHeaderPicture(section, headerPicture)
        Sets an image in the header of a worksheet.
        Parameters:
        section: int -

        0:Left Section.

        1:Center Section

        2:Right Section

        headerPicture: byte[] - Image data.
        Returns:
        Returns Picture object.
      • setFooterPicture

        Picture setFooterPicture(section, footerPicture)
        Sets an image in the footer of a worksheet.
        Parameters:
        section: int -

        0:Left Section.

        1:Center Section

        2:Right Section

        footerPicture: byte[] - Image data.
        Returns:
        Returns Picture object.
      • setPicture

        Picture setPicture(isFirst, isEven, isHeader, section, imageData)
        Sets an image in the header/footer of a worksheet.
        Parameters:
        isFirst: boolean - Indicateds whether setting the picture of first page header/footer.
        isEven: boolean - Indicateds whether setting the picture of even page header/footer.
        isHeader: boolean - Indicateds whether setting the picture of header/footer.
        section: int -

        0:Left Section.

        1:Center Section

        2:Right Section

        imageData: byte[] - Image data.
        Returns:
        Returns Picture object.
      • getPicture

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

        0:Left Section.

        1:Center Section

        2:Right Section

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

        Picture getPicture(isFirst, isEven, isHeader, section)
        Gets the Picture object of the header / footer.
        Parameters:
        isFirst: boolean - Indicateds whether getting the picture of first page header/footer.
        isEven: boolean - Indicateds whether getting the picture of even page header/footer.
        isHeader: boolean - Indicateds whether getting the picture of header/footer.
        section: int -

        0:Left Section.

        1:Center Section

        2:Right Section

        Returns:
        Returns Picture object.
      • copy

         copy(source, copyOptions)
        Copys the setting of the page setup.
        Parameters:
        source: PageSetup - The source.
        copyOptions: CopyOptions - The copy options.
      • setFitToPages

         setFitToPages(wide, tall)
        Sets the number of pages the worksheet will be scaled to when it's printed.
        Parameters:
        wide: int - Pages wide.
        tall: int - Pages tall.
      • customPaperSize

         customPaperSize(width, height)
        Sets the custom paper size, in unit of inches.
        Parameters:
        width: float - The width of the paper.
        height: float - The height of the paper.
      • clearHeaderFooter

         clearHeaderFooter()
        Clears header and footer setting.
      • getHeader

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

        0:Left Section.

        1:Center Section

        2:Right Section

      • getCommands

        HeaderFooterCommand[] getCommands(headerFooterScript)
        Gets all commands of header or footer.
        Parameters:
        headerFooterScript: String - The header/footer script
        Returns:
        Returns all commands of header or footer.
      • getFooter

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

        0:Left Section.

        1:Center Section

        2:Right Section

      • setHeader

         setHeader(section, 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: int -

        0:Left Section.

        1:Center Section

        2:Right Section

        headerScript: String - Header format script.
      • setFooter

         setFooter(section, footerScript)
        Sets a script formatting the footer of an Excel file. dddd

        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: int -

        0:Left Section.

        1:Center Section

        2:Right Section

        footerScript: String - Footer format script.
      • setEvenHeader

         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:
        section: int -

        0:Left Section.

        1:Center Section

        2:Right Section

        headerScript: String - Header format script.
      • getEvenHeader

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

        0:Left Section.

        1:Center Section

        2:Right Section

      • setEvenFooter

         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:
        section: int -

        0:Left Section.

        1:Center Section

        2:Right Section

        footerScript: String - Footer format script.
      • getEvenFooter

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

        0:Left Section.

        1:Center Section

        2:Right Section

      • setFirstPageHeader

         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:
        section: int -

        0:Left Section.

        1:Center Section

        2:Right Section

        headerScript: String - Header format script.
      • getFirstPageHeader

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

        0:Left Section.

        1:Center Section

        2:Right Section

      • setFirstPageFooter

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

        0:Left Section.

        1:Center Section

        2:Right Section

        footerScript: String - Footer format script.
      • getFirstPageFooter

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

        0:Left Section.

        1:Center Section

        2:Right Section