aspose.cells

Class PageSetup

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

Example:

$workbook = new cells\Workbook();
$sheet = $workbook->getWorksheets()->get(0);
$pagesetup = $sheet->getPageSetup();
$pagesetup->setPrintArea("D1:K13");
$pagesetup->setPrintTitleRows("\$5:\$7");
$pagesetup->setPrintTitleColumns("\$A:\$B");

Property Getters/Setters Summary
functiongetBlackAndWhite()
function
           Represents if elements of the document will be printed in black and white.
functiongetBottomMargin()
function
           Represents the size of the bottom margin, in unit of centimeters.
functiongetBottomMarginInch()
function
           Represents the size of the bottom margin, in unit of inches.
functiongetCenterHorizontally()
function
           Represent if the sheet is printed centered horizontally.
functiongetCenterVertically()
function
           Represent if the sheet is printed centered vertically.
functiongetFirstPageNumber()
function
           Represents the first page number that will be used when this sheet is printed.
functiongetFitToPagesTall()
function
           Represents the number of pages tall the worksheet will be scaled to when it's printed. The default value is 1.
functiongetFitToPagesWide()
function
           Represents the number of pages wide the worksheet will be scaled to when it's printed. The default value is 1.
functiongetFooterMargin()
function
           Represents the distance from the bottom of the page to the footer, in unit of centimeters.
functiongetFooterMarginInch()
function
           Represents the distance from the bottom of the page to the footer, in unit of inches.
functiongetHeaderMargin()
function
           Represents the distance from the top of the page to the header, in unit of centimeters.
functiongetHeaderMarginInch()
function
           Represents the distance from the top of the page to the header, in unit of inches.
functionisAutoFirstPageNumber()
function
           Indicates whether the first the page number is automatically assigned.
functionisAutomaticPaperSize()
Indicates whether the paper size is automatic.
functionisHFAlignMargins()
function
           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.
functionisHFDiffFirst()
function
           True means that the header/footer of the first page is different with other pages.
functionisHFDiffOddEven()
function
           True means that the header/footer of the odd pages is different with odd pages.
functionisHFScaleWithDoc()
function
           Indicates whether header and footer are scaled with document scaling. Only applies for Excel 2007.
functionisPercentScale()
function
           If this property is False, the FitToPagesWide and FitToPagesTall properties control how the worksheet is scaled.
functiongetLeftMargin()
function
           Represents the size of the left margin, in unit of centimeters.
functiongetLeftMarginInch()
function
           Represents the size of the left margin, in unit of inches.
functiongetODSPageBackground()
Gets the background of ODS.
functiongetOrder()
function
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.
functiongetOrientation()
function
           Represents page print orientation. The value of the property is PageOrientationType integer constant.
functiongetPaperHeight()
Represents the height in inches of the paper, considered page orientation.
functiongetPaperSize()
function
           Represents the size of the paper. The value of the property is PaperSizeType integer constant.
functiongetPaperWidth()
Represents the width in inches of the paper, considered page orientation.
functiongetPrintArea()
function
           Represents the range to be printed.
functiongetPrintComments()
function
           Represents the way comments are printed with the sheet. The value of the property is PrintCommentsType integer constant.
functiongetPrintCopies()
function
           Get and sets number of copies to print.
functiongetPrintDraft()
function
           Represents if the sheet will be printed without graphics.
functiongetPrintErrors()
function
           Specifies the type of print error displayed. The value of the property is PrintErrorsType integer constant.
functiongetPrinterSettings()
function
           Gets and sets the settings of the default printer.
functiongetPrintGridlines()
function
           Represents if cell gridlines are printed on the page.
functiongetPrintHeadings()
function
           Represents if row and column headings are printed with this page.
functiongetPrintQuality()
function
           Represents the print quality.
functiongetPrintTitleColumns()
function
           Represents the columns that contain the cells to be repeated on the left side of each page.
functiongetPrintTitleRows()
function
           Represents the rows that contain the cells to be repeated at the top of each page.
functiongetRightMargin()
function
           Represents the size of the right margin, in unit of centimeters.
functiongetRightMarginInch()
function
           Represents the size of the right margin, in unit of inches.
functiongetTopMargin()
function
           Represents the size of the top margin, in unit of centimeters.
functiongetTopMarginInch()
function
           Represents the size of the top margin, in unit of inches.
functiongetZoom()
function
setZoom(value)
           Represents the scaling factor in percent. It should be between 10 and 400.
 
Method Summary
functionclearHeaderFooter()
Clears header and footer setting.
functioncopy(source, copyOptions)
Copys the setting of the page setup.
functioncustomPaperSize(width, height)
Sets the custom paper size, in unit of inches.
functiongetCommands(headerFooterScript)
Gets all commands of header or footer.
functiongetEvenFooter(section)
Gets a script formatting the even footer of an Excel file.
functiongetEvenHeader(section)
Gets a script formatting the even header of an Excel file.
functiongetFirstPageFooter(section)
Gets a script formatting the first page footer of an Excel file.
functiongetFirstPageHeader(section)
Gets a script formatting the first page header of an Excel file.
functiongetFooter(section)
Gets a script formatting the footer of an Excel file.
functiongetHeader(section)
Gets a script formatting the header of an Excel file.
functiongetPicture(isFirst, isEven, isHeader, section)
Gets the Picture object of the header / footer.
functiongetPicture(isHeader, section)
Gets the Picture object of the header / footer.
functionsetEvenFooter(section, footerScript)
Sets a script formatting the even page footer of an Excel file. Only effect in Excel 2007 when IsHFDiffOddEven is true.
functionsetEvenHeader(section, headerScript)
Sets a script formatting the even page header of an Excel file. Only effect in Excel 2007 when IsHFDiffOddEven is true.
functionsetFirstPageFooter(section, footerScript)
Sets a script formatting the first page footer of an Excel file.
functionsetFirstPageHeader(section, headerScript)
Sets a script formatting the first page header of an Excel file. Only effect in Excel 2007 when IsHFDiffFirst is true.
functionsetFitToPages(wide, tall)
Sets the number of pages the worksheet will be scaled to when it's printed.
functionsetFooter(section, footerScript)
Sets a script formatting the footer of an Excel file.
functionsetFooterPicture(section, footerPicture)
Sets an image in the footer of a worksheet.
functionsetHeader(section, headerScript)
Sets a script formatting the header of an Excel file.
functionsetHeaderPicture(section, headerPicture)
Sets an image in the header of a worksheet.
functionsetPicture(isFirst, isEven, isHeader, section, imageData)
Sets an image in the header/footer of a worksheet.
 

    • Property Getters/Setters Detail

      • getODSPageBackground : OdsPageBackground 

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

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

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

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

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

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

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

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

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

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

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

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

        function getPrinterSettings() / function setPrinterSettings(value)
        
        Gets and sets the settings of the default printer.
      • getLeftMargin/setLeftMargin : Number 

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

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

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

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

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

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

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

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

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

        function getFitToPagesTall() / function 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 : Number 

        function getFitToPagesWide() / function 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 

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

        function getOrder() / function 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 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        0:Left Section.

        1:Center Section

        2:Right Section

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

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

        0:Left Section.

        1:Center Section

        2:Right Section

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

        function 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: Number -

        0:Left Section.

        1:Center Section

        2:Right Section

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

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

        0:Left Section.

        1:Center Section

        2:Right Section

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

        function 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: Number -

        0:Left Section.

        1:Center Section

        2:Right Section

        Returns:
        Returns Picture object.
      • copy

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

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

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

        function clearHeaderFooter()
        Clears header and footer setting.
      • getHeader

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

        0:Left Section.

        1:Center Section

        2:Right Section

      • getCommands

        function 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

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

        0:Left Section.

        1:Center Section

        2:Right Section

      • setHeader

        function 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: Number -

        0:Left Section.

        1:Center Section

        2:Right Section

        headerScript: String - Header format script.
      • setFooter

        function 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: Number -

        0:Left Section.

        1:Center Section

        2:Right Section

        footerScript: String - Footer format script.
      • setEvenHeader

        function 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: Number -

        0:Left Section.

        1:Center Section

        2:Right Section

        headerScript: String - Header format script.
      • getEvenHeader

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

        0:Left Section.

        1:Center Section

        2:Right Section

      • setEvenFooter

        function 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: Number -

        0:Left Section.

        1:Center Section

        2:Right Section

        footerScript: String - Footer format script.
      • getEvenFooter

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

        0:Left Section.

        1:Center Section

        2:Right Section

      • setFirstPageHeader

        function 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: Number -

        0:Left Section.

        1:Center Section

        2:Right Section

        headerScript: String - Header format script.
      • getFirstPageHeader

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

        0:Left Section.

        1:Center Section

        2:Right Section

      • setFirstPageFooter

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

        0:Left Section.

        1:Center Section

        2:Right Section

        footerScript: String - Footer format script.
      • getFirstPageFooter

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

        0:Left Section.

        1:Center Section

        2:Right Section