SheetXL - v1.0.2
    Preparing search index...

    Interface IPageLayout

    How a sheet is laid out on printed pages: paper, orientation, scale, margins, what is printed besides the cells, the headers and footers, the print area and the rows and columns repeated on every page.

    Shaped after Office Scripts' PageLayout, reached the same way (IWorksheet.getPageLayout). The manual page breaks are here too, with the rest of what decides the pages. Office Scripts has them on the worksheet, and so does IWorksheet: IWorksheet.getHorizontalPageBreaks and the others are the same breaks.

    Setters return the layout rather than void, so calls can be chained.

    SheetXL does not print; these settings are kept with the sheet and written to the file.

    interface IPageLayout {
        isIPageLayout: true;
        addHorizontalPageBreak(
            pageBreakRange: ICellRange.Address,
            options?: ITransaction.OperationOptions,
        ): IPageBreak;
        addVerticalPageBreak(
            pageBreakRange: ICellRange.Address,
            options?: ITransaction.OperationOptions,
        ): IPageBreak;
        getBlackAndWhite(): boolean;
        getBottomMargin(): number;
        getCenterHorizontally(): boolean;
        getCenterVertically(): boolean;
        getDraftMode(): boolean;
        getFirstPageNumber(): number | "";
        getFooterMargin(): number;
        getHeaderMargin(): number;
        getHeadersFooters(): IHeaderFooterGroup;
        getHorizontalPageBreaks(): IPageBreak[];
        getLeftMargin(): number;
        getOrientation(): IPageLayout.Orientation;
        getPaperSize(): IPageLayout.PaperType | null;
        getPaperSizeCode(): number;
        getPrintArea(): ICellRanges | null;
        getPrintComments(): IPageLayout.PrintComments;
        getPrintErrors(): IPageLayout.PrintErrorType;
        getPrintGridlines(): boolean;
        getPrintHeadings(): boolean;
        getPrintOrder(): IPageLayout.PrintOrder;
        getPrintTitleColumns(): ICellRange | null;
        getPrintTitleRows(): ICellRange | null;
        getRightMargin(): number;
        getTopMargin(): number;
        getVerticalPageBreaks(): IPageBreak[];
        getZoom(): ZoomOptions;
        removeAllHorizontalPageBreaks(
            options?: ITransaction.OperationOptions,
        ): this;
        removeAllVerticalPageBreaks(options?: ITransaction.OperationOptions): this;
        setBlackAndWhite(
            blackAndWhite: boolean,
            options?: ITransaction.OperationOptions,
        ): this;
        setBottomMargin(
            bottomMargin: number,
            options?: ITransaction.OperationOptions,
        ): this;
        setCenterHorizontally(
            centerHorizontally: boolean,
            options?: ITransaction.OperationOptions,
        ): this;
        setCenterVertically(
            centerVertically: boolean,
            options?: ITransaction.OperationOptions,
        ): this;
        setDraftMode(
            draftMode: boolean,
            options?: ITransaction.OperationOptions,
        ): this;
        setFirstPageNumber(
            firstPageNumber: number | "" | null,
            options?: ITransaction.OperationOptions,
        ): this;
        setFooterMargin(
            footerMargin: number,
            options?: ITransaction.OperationOptions,
        ): this;
        setHeaderMargin(
            headerMargin: number,
            options?: ITransaction.OperationOptions,
        ): this;
        setLeftMargin(
            leftMargin: number,
            options?: ITransaction.OperationOptions,
        ): this;
        setOrientation(
            orientation: IPageLayout.Orientation,
            options?: ITransaction.OperationOptions,
        ): this;
        setPaperSize(
            paperSize: number | IPageLayout.PaperType,
            options?: ITransaction.OperationOptions,
        ): this;
        setPrintArea(
            printArea: ICellRanges.Address | null,
            options?: ITransaction.OperationOptions,
        ): this;
        setPrintComments(
            printComments: IPageLayout.PrintComments,
            options?: ITransaction.OperationOptions,
        ): this;
        setPrintErrors(
            printErrors: IPageLayout.PrintErrorType,
            options?: ITransaction.OperationOptions,
        ): this;
        setPrintGridlines(
            printGridlines: boolean,
            options?: ITransaction.OperationOptions,
        ): this;
        setPrintHeadings(
            printHeadings: boolean,
            options?: ITransaction.OperationOptions,
        ): this;
        setPrintMargins(
            unit: IPageLayout.PrintMarginUnit,
            marginOptions: MarginOptions,
            options?: ITransaction.OperationOptions,
        ): this;
        setPrintOrder(
            printOrder: IPageLayout.PrintOrder,
            options?: ITransaction.OperationOptions,
        ): this;
        setPrintTitleColumns(
            printTitleColumns: string | ICellRange | null,
            options?: ITransaction.OperationOptions,
        ): this;
        setPrintTitleRows(
            printTitleRows: string | ICellRange | null,
            options?: ITransaction.OperationOptions,
        ): this;
        setRightMargin(
            rightMargin: number,
            options?: ITransaction.OperationOptions,
        ): this;
        setTopMargin(
            topMargin: number,
            options?: ITransaction.OperationOptions,
        ): this;
        setZoom(zoom: ZoomOptions, options?: ITransaction.OperationOptions): this;
    }
    Index
    isIPageLayout: true

    For runtime type checking.

    • Whether the sheet prints in black and white.

      Returns boolean

      false
      
    • The bottom margin, in points.

      Returns number

      54 (0.75 inch)
      
    • Whether the printed area is centered horizontally on the page.

      Returns boolean

      false
      
    • Whether the printed area is centered vertically on the page.

      Returns boolean

      false
      
    • Whether the sheet prints in draft quality, without graphics.

      Returns boolean

      false
      
    • The number printed on the first page, or "" when pages are numbered automatically.

      Returns number | ""

      ""

    • The distance from the bottom of the page to the footer, in points.

      Returns number

      21.6 (0.3 inch)
      
    • The distance from the top of the page to the header, in points.

      Returns number

      21.6 (0.3 inch)
      
    • The manual page breaks before rows, in order.

      Returns IPageBreak[]

      Breaks the print layout places by itself are not included.

    • The left margin, in points.

      Returns number

      50.4 (0.7 inch)
      
    • The paper size as the number the file stores it by: 1 letter, 9 A4, and so on. This is also the value of VBA's PageSetup.PaperSize.

      Returns number

    • The ranges printed, or null when the whole used range prints.

      Returns ICellRanges | null

      Office Scripts returns undefined here; this returns null.

      Kept as the sheet-scoped name _xlnm.Print_Area (see IWorksheet.getNames), so it follows rows and columns inserted and deleted the way any name does.

    • Whether the gridlines are printed.

      Returns boolean

      false
      

      Independent of whether they are shown on screen (IWorksheetView.setShowRowGridlines).

    • Whether the row numbers and column letters are printed.

      Returns boolean

      false
      
    • The columns repeated at the left of every page, or null when there are none.

      Returns ICellRange | null

      Office Scripts returns undefined here; this returns null.

    • The rows repeated at the top of every page, or null when there are none.

      Returns ICellRange | null

      Office Scripts returns undefined here; this returns null.

      Kept, with getPrintTitleColumns, as the sheet-scoped name _xlnm.Print_Titles.

    • The right margin, in points.

      Returns number

      50.4 (0.7 inch)
      
    • The top margin, in points.

      Returns number

      54 (0.75 inch)
      
    • How the sheet is scaled: a percentage, or the number of pages to fit it to.

      Returns ZoomOptions

      { scale: 100 }

      Exactly one form is returned. Fitting to pages returns both counts; 0 means as many pages as the content needs in that direction (Excel's "Automatic").

    • Sets the number printed on the first page; "" or null numbers the pages automatically.

      Parameters

      Returns this

    • Sets the columns repeated at the left of every page, as entire columns ('A:B'). null or "" clears them.

      Parameters

      Returns this

      Error If the range is not one block of entire columns.

    • Sets the rows repeated at the top of every page, as entire rows ('1:2'). null or "" clears them.

      Parameters

      Returns this

      Error If the range is not one block of entire rows.

    • Scales the sheet to a percentage, or fits it to a number of pages.

      Parameters

      Returns this

      Error If both a scale and a page count are given, or a value is out of range.

      Giving one page count keeps the other. Switching from one form to the other keeps the values of the form not in use, as Excel does.