ExcelSheetPageSetup
OfficeIMO.Excel
Page setup of a worksheet: paper, orientation, scaling, margins, print area and titles, print options, and headers and footers. Values are read from and written to the worksheet directly.
Inheritance
- object
- ExcelSheetPageSetup
Usage
Explore 4 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 4
- Property ExcelSheet.PageSetup
- Method ExcelSheetPageSetup.ApplyLayout
- Method ExcelSheetPageSetup.SetMargins
- Method ExcelSheetPageSetup.SetPrintTitles
Methods
public ExcelSheetPageSetup ApplyLayout(ExcelPrintLayoutOptions options) #Applies a print layout preset, such as Report or Wide, with optional overrides.
Parameters
- options OfficeIMO.Excel.ExcelPrintLayoutOptions
Returns
ExcelSheetPageSetuppublic ExcelSheetPageSetup ApplyLayout(ExcelPrintLayoutPreset preset, string? printArea = null) #Applies a print layout preset and an optional print area.
Parameters
- preset OfficeIMO.Excel.ExcelPrintLayoutPreset
- printArea string? = null
Returns
ExcelSheetPageSetuppublic ExcelSheetPageSetup SetMargins(OfficeLength left, OfficeLength right, OfficeLength top, OfficeLength bottom, OfficeLength? header = null, OfficeLength? footer = null) #Sets physical page margins. Omitted header and footer margins are 0.3 inches.
Parameters
- left OfficeIMO.OfficeLength
- right OfficeIMO.OfficeLength
- top OfficeIMO.OfficeLength
- bottom OfficeIMO.OfficeLength
- header OfficeIMO.OfficeLength? = null
- footer OfficeIMO.OfficeLength? = null
Returns
ExcelSheetPageSetuppublic ExcelSheetPageSetup SetMargins(ExcelMarginPreset preset) #Sets the margins of one of Excel's margin presets.
Parameters
- preset OfficeIMO.Excel.ExcelMarginPreset
Returns
ExcelSheetPageSetuppublic ExcelSheetPageSetup SetPrintTitles(int? firstRow, int? lastRow, int? firstColumn = null, int? lastColumn = null) #Sets the rows and columns repeated on every printed page; nulls on both axes clear them.
Parameters
- firstRow int?
- lastRow int?
- firstColumn int? = null
- lastColumn int? = null
Returns
ExcelSheetPageSetupInherited Methods
Properties
public OfficePageOrientation? Orientation { get; set; } #Page orientation; null when the worksheet does not store one (Excel prints portrait).
public ExcelPaperSize? PaperSize { get; set; } #Known paper size; null when none is stored or the stored code has no ExcelPaperSize value.
public uint? PaperSizeCode { get; } #Stored OpenXML paper-size code, including codes without an ExcelPaperSize value.
public uint? FitToWidth { get; set; } #Pages to fit horizontally when fit-to-page is on; null when it is off. Setting a value turns fit-to-page on. An omitted dimension defaults to one; zero leaves the axis unlimited.
public uint? FitToHeight { get; set; } #Pages to fit vertically when fit-to-page is on; null when it is off. Setting a value turns fit-to-page on. An omitted dimension defaults to one; zero leaves the axis unlimited.
public uint? Scale { get; set; } #Manual print scale percentage (10-400); null when none is stored.
public ExcelPageOrder? PageOrder { get; set; } #Order in which multi-page sheets print; null when none is stored.
public ExcelSheetPageMargins? Margins { get; } #Page margins; null when the worksheet does not store them.
public string? PrintArea { get; set; } #Print area as stored, with one or more comma-separated areas; null when none is set. Setting null removes it.
public IReadOnlyList<string> PrintAreas { get; } #The separate print areas in their stored order; empty when none is set.
public ExcelPrintTitles PrintTitles { get; } #Rows and columns repeated on every printed page.
public bool PrintHeadings { get; set; } #Whether row and column headings print.
public bool HorizontalCentered { get; set; } #Whether the printed sheet is centered horizontally on the page.
public bool VerticalCentered { get; set; } #Whether the printed sheet is centered vertically on the page.
public ExcelHeaderFooter Header { get; } #Header on every page, or on odd pages when ExcelSheetPageSetup.DifferentOddEven is on.
public ExcelHeaderFooter FirstPageHeader { get; } #Header on the first page; writing text turns ExcelSheetPageSetup.DifferentFirstPage on.
public ExcelHeaderFooter EvenPageHeader { get; } #Header on even pages; writing text turns ExcelSheetPageSetup.DifferentOddEven on.
public bool DifferentFirstPage { get; set; } #Whether the first page uses its own header and footer. Turning it on copies the running header and footer into a missing first-page variant; existing first-page text is kept when it is turned off.
public bool DifferentOddEven { get; set; } #Whether even pages use their own header and footer. Turning it on copies the running header and footer into a missing even-page variant; existing even-page text is kept when it is turned off.