Class which exposes the various print options available for a worksheet which can be saved with both a worksheet and a custom view.

This class provides a way to control how a worksheet is printed.

See

  • [[Worksheet.printOptions]]
  • [[CustomView.getPrintOptions]]

Hierarchy

Hierarchy (view full)

Constructors

Properties

$type: Type
$t: Type
nextHashCode: number

Accessors

  • get alignHeadersAndFootersWithMargins(): boolean
  • Gets or sets the value indicating whether to align header and footer margins with page margins.

    See

    • [[header]]
    • [[footer]]
    • [[headerMargin]]
    • [[footerMargin]]
    • [[leftMargin]]
    • [[rightMargin]]

    Returns boolean

  • set alignHeadersAndFootersWithMargins(a): void
  • Parameters

    • a: boolean

    Returns void

  • get bottomMargin(): number
  • Gets or sets the margin at the bottom of each printed page of the worksheet, specified in inches. The margin at the bottom of each printed page of the worksheet, specified in inches.

    Throws

    [[ArgumentOutOfRangeException]] The assigned value is outside the valid margin range of 0 and 100 inches.

    See

    • [[footerMargin]]
    • [[headerMargin]]
    • [[leftMargin]]
    • [[rightMargin]]
    • [[topMargin]]

    Returns number

  • set bottomMargin(a): void
  • Parameters

    • a: number

    Returns void

  • get centerHorizontally(): boolean
  • Gets or sets the value indicating whether the printed pages should be centered horizontally. The value indicating whether the printed pages should be centered horizontally.

    See

    [[centerVertically]]

    Returns boolean

  • set centerHorizontally(a): void
  • Parameters

    • a: boolean

    Returns void

  • get centerVertically(): boolean
  • Gets or sets the value indicating whether the printed pages should be centered vertically. The value indicating whether the printed pages should be centered vertically.

    See

    [[centerHorizontally]]

    Returns boolean

  • set centerVertically(a): void
  • Parameters

    • a: boolean

    Returns void

  • get columnsToRepeatAtLeft(): RepeatTitleRange
  • Gets or sets the range of columns which should be printed on every page.

    Throws

    [[ArgumentException]]

    See

    • [[RepeatTitleRange.endIndex]] Occurs when the value specified is not null and its value is greater than or equal to the number of columns in the [[Worksheet]].
    • [[rowsToRepeatAtTop]]

    Returns RepeatTitleRange

  • set columnsToRepeatAtLeft(a): void
  • Parameters

    Returns void

  • get draftQuality(): boolean
  • Gets or sets the value indicating whether the printed pages should be printed using draft quality. The value indicating whether the printed pages should be printed using draft quality.

    Returns boolean

  • set draftQuality(a): void
  • Parameters

    • a: boolean

    Returns void

  • get footer(): string
  • Gets or sets the footer for each page of the printed worksheet.

    The '&' character in the header and footer is a special character. Depending on what is after it, the formatting of the text can be controlled or dynamic text can be inserted. Below is a list of the available commands: Section commands &L The following text will appear in the left section. The formatting of new sections is always the default formatting, regardless of the formatting of the previous section. &C The following text will appear in the center section. The formatting of new sections is always the default formatting, regardless of the formatting of the previous section. &R The following text will appear in the right section. The formatting of new sections is always the default formatting, regardless of the formatting of the previous section. Replacement commands && Insert the '&' character. &A Insert the current worksheet name. &D Insert the current date. &F Insert the current file name. &G Insert an image (Note: This command is currently not supported). &N Insert the number of pages the worksheet will need to print. &P Insert the current page number. &T Insert the current time. &Z Insert the current file path (without the file name). Formatting commands &B Toggle bold. &E Toggle double underlining. &I Toggle italics. &S Toggle strikethrough. &U Toggle underlining. &X Toggle superscript. &Y Toggle subscript. & Sets a new font size for the following text. The size is expressed as a positive integer. If a number is to follow this command in the header, it must be separated by a space. &"" Sets a new font for the following text. If the font name is not recognized, the default font will be used. &"," Sets the new font and font style for the following text. The font style is usually "Regular", "Bold", "Italic", or "Bold Italic", but can be other styles depending on the font. The available font styles can be seen in the font dialog when a font is selected.

    The header or footer string could look like this: &L&"Arial,Bold"&D&CPage &P of &N on &A&R&14&F.

    The footer for each page of the worksheet.

    See

    • [[header]]
    • [[footerMargin]]

    Returns string

  • set footer(a): void
  • Parameters

    • a: string

    Returns void

  • get footerMargin(): number
  • Gets or sets the footer margin for each printed page of the worksheet, specified in inches. The footer margin for each printed page of the worksheet, specified in inches.

    Throws

    [[ArgumentOutOfRangeException]] The assigned value is outside the valid margin range of 0 and 100 inches.

    See

    • [[footer]]
    • [[bottomMargin]]
    • [[headerMargin]]
    • [[leftMargin]]
    • [[rightMargin]]
    • [[topMargin]]

    Returns number

  • set footerMargin(a): void
  • Parameters

    • a: number

    Returns void

  • get header(): string
  • Gets or sets the header for each page of the printed worksheet.

    The '&' character in the header and footer is a special character. Depending on what is after it, the formatting of the text can be controlled or dynamic text can be inserted. Below is a list of the available commands: Section commands &L The following text will appear in the left section. The formatting of new sections is always the default formatting, regardless of the formatting of the previous section. &C The following text will appear in the center section. The formatting of new sections is always the default formatting, regardless of the formatting of the previous section. &R The following text will appear in the right section. The formatting of new sections is always the default formatting, regardless of the formatting of the previous section. Replacement commands && Insert the '&' character. &A Insert the current worksheet name. &D Insert the current date. &F Insert the current file name. &G Insert an image (Note: This command is currently not supported). &N Insert the number of pages the worksheet will need to print. &P Insert the current page number. &T Insert the current time. &Z Insert the current file path (without the file name). Formatting commands &B Toggle bold. &E Toggle double underlining. &I Toggle italics. &S Toggle strikethrough. &U Toggle underlining. &X Toggle superscript. &Y Toggle subscript. & Sets a new font size for the following text. The size is expressed as a positive integer. If a number is to follow this command in the header, it must be separated by a space. &"" Sets a new font for the following text. If the font name is not recognized, the default font will be used. &"," Sets the new font and font style for the following text. The font style is usually "Regular", "Bold", "Italic", or "Bold Italic", but can be other styles depending on the font. The available font styles can be seen in the font dialog when a font is selected.

    The header or footer string could look like this: &L&"Arial,Bold"&D&CPage &P of &N on &A&R&14&F.

    The header for each page of the worksheet.

    See

    • [[footer]]
    • [[headerMargin]]

    Returns string

  • set header(a): void
  • Parameters

    • a: string

    Returns void

  • get headerMargin(): number
  • Gets or sets the header margin for each printed page of the worksheet, specified in inches. The header margin for each printed page of the worksheet, specified in inches.

    Throws

    [[ArgumentOutOfRangeException]] The assigned value is outside the valid margin range of 0 and 100 inches.

    See

    • [[header]]
    • [[bottomMargin]]
    • [[footerMargin]]
    • [[leftMargin]]
    • [[rightMargin]]
    • [[topMargin]]

    Returns number

  • set headerMargin(a): void
  • Parameters

    • a: number

    Returns void

  • get leftMargin(): number
  • Gets or sets the margin at the left of each printed page of the worksheet, specified in inches. The margin at the left of each printed page of the worksheet, specified in inches.

    Throws

    [[ArgumentOutOfRangeException]] The assigned value is outside the valid margin range of 0 and 100 inches.

    See

    • [[bottomMargin]]
    • [[footerMargin]]
    • [[headerMargin]]
    • [[rightMargin]]
    • [[topMargin]]

    Returns number

  • set leftMargin(a): void
  • Parameters

    • a: number

    Returns void

  • get maxPagesHorizontally(): number
  • Gets or sets the maximum number of pages allowed in the horizontal direction to print the worksheet.

    A value of zero indicates no maximum is used in the horizontal direction. As many pages as needed will be used.

    Note: For MaxPagesHorizontally and [[maxPagesVertically]] to affect the way the worksheet is printed, [[scalingType]] must be set to a value of FitToPages. However, if the the ScalingType is different and these values aren't used, they will still be saved with the worksheet.

    The maximum number of pages allowed in the horizontal direction to print the worksheet.

    Throws

    [[ArgumentOutOfRangeException]] The value assigned is outside the valid range of 0 and 32767.

    See

    • [[maxPagesVertically]]
    • [[scalingType]]

    Returns number

  • set maxPagesHorizontally(a): void
  • Parameters

    • a: number

    Returns void

  • get maxPagesVertically(): number
  • Gets or sets the maximum number of pages allowed in the vertical direction to print the worksheet.

    A value of zero indicates no maximum is used in the vertical direction. As many pages as needed will be used.

    Note: For [[maxPagesHorizontally]] and MaxPagesVertically to affect the way the worksheet is printed, [[scalingType]] must be set to a value of FitToPages. However, if the the ScalingType is different and these values aren't used, they will still be saved with the worksheet.

    The maximum number of pages allowed in the vertical direction to print the worksheet.

    Throws

    [[ArgumentOutOfRangeException]] The value assigned is outside the valid range of 0 and 32767.

    See

    • [[maxPagesHorizontally]]
    • [[scalingType]]

    Returns number

  • set maxPagesVertically(a): void
  • Parameters

    • a: number

    Returns void

  • get numberOfCopies(): number
  • Gets or sets the number of copies to print. The number of copies to print.

    Throws

    [[ArgumentOutOfRangeException]] The assigned value is outside the valid range of 1 and 65535.

    Returns number

  • set numberOfCopies(a): void
  • Parameters

    • a: number

    Returns void

  • get orientation(): Orientation
  • Gets or sets the orientation for each page of the printed worksheet. The orientation for each page of the printed worksheet.

    Throws

    [[InvalidEnumArgumentException]] The assigned value is not defined in the [[orientation]] enumeration.

    Returns Orientation

  • set orientation(a): void
  • Parameters

    Returns void

  • get orientationResolved(): Orientation
  • Returns the resolved orientation for each page of the printed worksheet.

    Returns Orientation

  • get pageNumbering(): PageNumbering
  • Gets or sets the method with which pages are numbered.

    If this is set to a value of UseStartPageNumber, the first page is numbered using the [[startPageNumber]].

    The method with which pages are numbered.

    Throws

    [[InvalidEnumArgumentException]] The assigned value is not defined in the [[pageNumbering]] enumeration.

    See

    [[startPageNumber]]

    Returns PageNumbering

  • set pageNumbering(a): void
  • Parameters

    Returns void

  • get pageOrder(): PageOrder
  • Gets or sets the order in which to print pages for multiple page worksheets. The order in which to print pages for multiple page worksheets.

    Throws

    [[InvalidEnumArgumentException]] The assigned value is not defined in the [[pageOrder]] enumeration.

    Returns PageOrder

  • set pageOrder(a): void
  • Parameters

    Returns void

  • get paperSize(): PaperSize
  • Gets or sets the paper size for each printed page of the worksheet. The paper size for each printed page of the worksheet.

    Throws

    [[InvalidEnumArgumentException]] The assigned value is not defined in the [[paperSize]] enumeration.

    Returns PaperSize

  • set paperSize(a): void
  • Parameters

    Returns void

  • get printErrors(): PrintErrors
  • Gets or sets the way error values of cells are printed.

    A cell can have an error value if its [[WorksheetCell.value]] is set directly to an [[ErrorValue]] or if it is set to a [[Formula]] that evaluates to an error.

    The way error values of cells are printed.

    Throws

    [[InvalidEnumArgumentException]] The assigned value is not defined in the [[printErrors]] enumeration.

    See

    • [[ErrorValue]]
    • [[Formula]]

    Returns PrintErrors

  • set printErrors(a): void
  • Parameters

    Returns void

  • get printGridlines(): boolean
  • Gets or sets the value which indicates whether to print the worksheet gridlines. The value which indicates whether to print the worksheet gridlines.

    See

    [[DisplayOptions.showGridlines]]

    Returns boolean

  • set printGridlines(a): void
  • Parameters

    • a: boolean

    Returns void

  • get printInBlackAndWhite(): boolean
  • Gets or sets the value indicating whether the worksheet should be printed in black and white. The value indicating whether the worksheet should be printed in black and white.

    Returns boolean

  • set printInBlackAndWhite(a): void
  • Parameters

    • a: boolean

    Returns void

  • get printNotes(): PrintNotes
  • Gets or sets the way cell comments are printed.

    If this is set to a value of PrintAsDisplayed, the comments will only print if they are displayed on the worksheet. If comments are hidden but indicators are shown, neither the indicators nor the comments will print.

    The way cell notes are printed.

    Throws

    [[InvalidEnumArgumentException]] The assigned value is not defined in the [[printNotes]] enumeration.

    See

    • [[WorksheetCell.comment]]
    • [[WorksheetCellComment]]

    Returns PrintNotes

  • set printNotes(a): void
  • Parameters

    Returns void

  • get printRowAndColumnHeaders(): boolean
  • Gets or sets the value indicating whether to print row and column headers.

    The row and column headers show the identifier of the row or column.

    The value indicating whether to print row and column headers.

    See

    [[DisplayOptions.showRowAndColumnHeaders]]

    Returns boolean

  • set printRowAndColumnHeaders(a): void
  • Parameters

    • a: boolean

    Returns void

  • get resolution(): number
  • Gets or sets the horizontal print resolution in DPI. The horizontal print resolution in DPI.

    Throws

    [[ArgumentOutOfRangeException]] The value assigned is outside the valid range of 0 and 65535.

    See

    [[verticalResolution]]

    Returns number

  • set resolution(a): void
  • Parameters

    • a: number

    Returns void

  • get rightMargin(): number
  • Gets or sets the margin at the right of each printed page of the worksheet, specified in inches. The margin at the right of each printed page of the worksheet, specified in inches.

    Throws

    [[ArgumentOutOfRangeException]] The assigned value is outside the valid margin range of 0 and 100 inches.

    See

    • [[bottomMargin]]
    • [[footerMargin]]
    • [[headerMargin]]
    • [[leftMargin]]
    • [[topMargin]]

    Returns number

  • set rightMargin(a): void
  • Parameters

    • a: number

    Returns void

  • get rowsToRepeatAtTop(): RepeatTitleRange
  • Gets or sets the range of rows which should be printed on every page.

    Throws

    [[ArgumentException]]

    See

    • [[RepeatTitleRange.endIndex]] Occurs when the value specified is not null and its value is greater than or equal to the number of rows in the [[Worksheet]].
    • [[columnsToRepeatAtLeft]]

    Returns RepeatTitleRange

  • set rowsToRepeatAtTop(a): void
  • Parameters

    Returns void

  • get scaleHeadersAndFootersWithDocument(): boolean
  • Gets or sets the value indicating whether to scale the headers and footers with the document scaling.

    See

    • [[header]]
    • [[footer]]
    • [[PrintOptions.scalingFactor]]
    • [[ScalingType]]

    Returns boolean

  • set scaleHeadersAndFootersWithDocument(a): void
  • Parameters

    • a: boolean

    Returns void

  • get scalingFactor(): number
  • Gets or sets the scaling factor to use when printing the worksheet.

    The scaling factor is similar to magnifications in that is it stored as a percentage of the normal scaling. A value of 100 indicates normal scaling whereas a value of 200 indicates the worksheet is scaled to twice its normal size.

    Note: For ScalingFactor to affect the way the worksheet is printed, [[scalingType]] must be set to a value of UseScalingFactor.

    The scaling factor to use when printing the worksheet.

    Throws

    [[ArgumentOutOfRangeException]] The assigned value is outside the valid range of 10 and 400.

    See

    • [[scalingType]]
    • [[WorksheetDisplayOptions.magnificationInNormalView]]
    • [[WorksheetDisplayOptions.magnificationInPageBreakView]]
    • [[WorksheetDisplayOptions.magnificationInPageLayoutView]]
    • [[CustomViewDisplayOptions.magnificationInCurrentView]]

    Returns number

  • set scalingFactor(a): void
  • Parameters

    • a: number

    Returns void

  • get scalingType(): ScalingType
  • Gets or sets the method for scaling the worksheet when it is printed.

    If this is set to a value of UseScalingFactor, [[scalingFactor]] is used to uniformly scale the worksheet on the printed pages.

    If this is set to a value of FitToPages, [[maxPagesHorizontally]] and [[maxPagesVertically]] are used to set the maximum number of pages to fit the printed worksheet into in both directions.

    The method for scaling the worksheet when it is printed.

    Throws

    [[InvalidEnumArgumentException]] The assigned value is not defined in the [[scalingType]] enumeration.

    See

    • [[maxPagesHorizontally]]
    • [[maxPagesVertically]]
    • [[scalingFactor]]

    Returns ScalingType

  • set scalingType(a): void
  • Parameters

    Returns void

  • get startPageNumber(): number
  • Gets or sets the page number for the first printed page of the worksheet.

    For this value to be used, [[pageNumbering]] must be set to a value of UseStartPageNumber.

    The page number for the first printed page of the worksheet.

    Throws

    [[ArgumentOutOfRangeException]] The assigned value is outside the valid range of -32765 and 32767.

    See

    [[pageNumbering]]

    Returns number

  • set startPageNumber(a): void
  • Parameters

    • a: number

    Returns void

  • get topMargin(): number
  • Gets or sets the margin at the top of each printed page of the worksheet, specified in inches. The margin at the top of each printed page of the worksheet, specified in inches.

    Throws

    [[ArgumentOutOfRangeException]] The assigned value is outside the valid margin range of 0 and 100 inches.

    See

    • [[bottomMargin]]
    • [[footerMargin]]
    • [[headerMargin]]
    • [[leftMargin]]
    • [[rightMargin]]

    Returns number

  • set topMargin(a): void
  • Parameters

    • a: number

    Returns void

  • get verticalResolution(): number
  • Gets or sets the vertical print resolution in DPI. The vertical print resolution in DPI.

    Throws

    [[ArgumentOutOfRangeException]] The value assigned is outside the valid range of 0 and 65535.

    See

    [[resolution]]

    Returns number

  • set verticalResolution(a): void
  • Parameters

    • a: number

    Returns void

Methods

  • Clears all page breaks from the [[PrintOptions]].

    See

    • [[PageBreakCollection1.clear]] @see [[PageBreakCollection1.remove]]
    • [[PageBreakCollection`1.removeAt]]

    Returns void

  • Parameters

    • other: any

    Returns boolean

  • Returns number

  • Gets the page break at the specified index.

    Throws

    [[ArgumentOutOfRangeException]] Occurs when 'index' is less than 0 or greater than of equal to [[PageBreakCollection`1.count]].

    Parameters

    • index: number

      The index of the page break to get.

    Returns HorizontalPageBreak

  • Gets the collection of horizontal page breaks in the [[Worksheet]].

    See

    • [[HorizontalPageBreak]]
    • [[clearPageBreaks]]
    • [[insertPageBreak]]
    • [[insertPageBreak]]
    • [[insertPageBreak]]

    Returns HorizontalPageBreakCollection

  • Inserts a horizontal and/or vertical page break before the specified cell.

    If the cell is not contained in one of the print areas in the [[printAreas]] collection, the page breaks added will be as follows: If the cell is at the top-left corner of the [[Worksheet]], an exception will be thrown. If the cell is on the left edge of the Worksheet, a horizontal page break will be inserted above the cell. If the cell is on the top edge of the Worksheet, a vertical page break will be inserted to the left of the cell. If the cell is anywhere else in the Worksheet, a horizontal page break will be inserted above the cell and a vertical page break will be inserted to the left of the cell.

    If the cell is contained in one of the print areas in the [[printAreas]] collection, the page breaks added will be as follows: If the cell is at the top-left corner of the print area, no page breaks will be inserted. If the cell is on the left edge of the print area, a horizontal page break will be inserted above the cell. If the cell is on the top edge of the print area, a vertical page break will be inserted to the left of the cell. If the cell is anywhere else in the print area, a horizontal page break will be inserted above the cell and a vertical page break will be inserted to the left of the cell.

    When page breaks are inserted in a print area, they will only extend to the edges of the print area.

    Throws

    [[ArgumentNullException]] Occurs when 'cell' is null.

    Throws

    [[ArgumentException]] Occurs when 'cell' is at the top-left corner of the [[Worksheet]].

    See

    • [[horizontalPageBreaks]]
    • [[verticalPageBreaks]]
    • [[clearPageBreaks]]
    • [[insertPageBreak]]
    • [[insertPageBreak]]
    • [[printAreas]]

    Parameters

    • cell: WorksheetCell

      The cell at which to insert the page break(s).

    Returns void

  • Inserts a vertical page break to the left of the specified column.

    If the column is not contained in one of the print areas in the [[printAreas]] collection, the page breaks added will be as follows: If the column is at the left edge of the [[Worksheet]], an exception will be thrown. If the column is anywhere else in the Worksheet, a vertical page break will be inserted to the left of the column.

    If the column is contained in one of the print areas in the [[printAreas]] collection, the page breaks added will be as follows: If the column is at the left edge of the print area, no page break will be inserted. If the column is anywhere else in the print area, a vertical page break will be inserted to the left of the column.

    Throws

    [[ArgumentNullException]] Occurs when 'column' is null.

    Throws

    [[ArgumentException]] Occurs when 'column' is at the left edge of the [[Worksheet]].

    See

    • [[verticalPageBreaks]]
    • [[clearPageBreaks]]
    • [[insertPageBreak]]
    • [[insertPageBreak]]
    • [[printAreas]]

    Parameters

    Returns void

  • Inserts a horizontal page break above the specified row.

    If the row is not contained in one of the print areas in the [[printAreas]] collection, the page breaks added will be as follows: If the row is at the top edge of the [[Worksheet]], an exception will be thrown. If the row is anywhere else in the Worksheet, a horizontal page break will be inserted above the row.

    If the row is contained in one of the print areas in the [[printAreas]] collection, the page breaks added will be as follows: If the row is at the top edge of the print area, no page break will be inserted. If the row is anywhere else in the print area, a horizontal page break will be inserted above the row.

    Throws

    [[ArgumentNullException]] Occurs when 'row' is null.

    Throws

    [[ArgumentException]] Occurs when 'row' is at the top edge of the [[Worksheet]].

    See

    • [[horizontalPageBreaks]]
    • [[clearPageBreaks]]
    • [[insertPageBreak]]
    • [[insertPageBreak]]
    • [[printAreas]]

    Parameters

    • row: WorksheetRow

      The row at which to insert the page break.

    Returns void

  • Gets the print area at the specified index.

    Throws

    [[ArgumentOutOfRangeException]] Occurs when 'index' is less than 0 or greater than or equal to the size of the collection.

    Parameters

    • index: number

      The index of the print area to get.

    Returns WorksheetRegion

  • Gets the collection of print areas in the [[Worksheet]].

    Returns PrintAreasCollection

  • Resets the print options to their default settings.

    The defaults used for each setting are the same defaults with which Microsoft Excel creates a blank worksheet.

    Returns void

  • Gets the page break at the specified index.

    Throws

    [[ArgumentOutOfRangeException]] Occurs when 'index' is less than 0 or greater than of equal to [[PageBreakCollection`1.count]].

    Parameters

    • index: number

      The index of the page break to get.

    Returns VerticalPageBreak

  • Gets the collection of vertical page breaks in the [[Worksheet]].

    See

    • [[VerticalPageBreak]]
    • [[clearPageBreaks]]
    • [[insertPageBreak]]
    • [[insertPageBreak]]
    • [[insertPageBreak]]

    Returns VerticalPageBreakCollection

  • Parameters

    • item1: any
    • item2: any

    Returns number

  • Parameters

    • item1: any
    • item2: any

    Returns number

  • Parameters

    • item1: any
    • item2: any

    Returns boolean

  • Parameters

    • a: any
    • b: any

    Returns boolean

  • Parameters

    • obj: any

    Returns any[]

  • Parameters

    • obj: any

    Returns any[]

  • Parameters

    • obj: any

    Returns number

  • Parameters

    • a: any
    • b: any

    Returns boolean