Table of Contents

Class PageSetup

Namespace
SheetStream
Assembly
SheetStream.dll

Print settings of a worksheet. Everything here can be set any time before the sheet is sealed, except FitToWidth and FitToHeight, which Excel stores in the sheet header and so must be set before the first row is written.

public sealed class PageSetup
Inheritance
PageSetup
Inherited Members

Properties

CenterHorizontally

Center the printout horizontally on the page.

public bool CenterHorizontally { get; set; }

Property Value

bool

CenterVertically

Center the printout vertically on the page.

public bool CenterVertically { get; set; }

Property Value

bool

FitToHeight

Fit the printout to this many pages tall (0 = automatic). Must be set before the first row.

public int? FitToHeight { get; set; }

Property Value

int?

FitToWidth

Fit the printout to this many pages wide (0 = automatic). Must be set before the first row, because the "fit to page" switch lives in the sheet header.

public int? FitToWidth { get; set; }

Property Value

int?

Page footer, same codes as Header. Example: "Page &P of &N".

public string? Footer { get; set; }

Property Value

string

Header

Page header. Use Excel's codes: &L, &C, &R for sections, &P page, &N pages, &D date, &A sheet name. A text without section codes is centered.

public string? Header { get; set; }

Property Value

string

Margins

Margins in inches: left, right, top, bottom, header, footer. Null keeps Excel's defaults.

public (double Left, double Right, double Top, double Bottom, double Header, double Footer)? Margins { get; set; }

Property Value

(double Left, double Right, double Top, double Bottom, double Header, double Footer)?

Orientation

Page orientation; null keeps the printer default.

public PageOrientation? Orientation { get; set; }

Property Value

PageOrientation?

PaperSize

Paper size; null keeps the printer default.

public PaperSize? PaperSize { get; set; }

Property Value

PaperSize?

PrintArea

Restricts printing to a range such as "A1:F50".

public string? PrintArea { get; set; }

Property Value

string

PrintGridlines

Print the cell gridlines.

public bool PrintGridlines { get; set; }

Property Value

bool

PrintTitleColumns

Columns repeated at the left of every printed page.

public (int From, int To)? PrintTitleColumns { get; set; }

Property Value

(int From, int To)?

PrintTitleRows

Rows repeated at the top of every printed page, e.g. (1, 1) for a header row.

public (int From, int To)? PrintTitleRows { get; set; }

Property Value

(int From, int To)?

Scale

Print scale in percent (10 to 400). Ignored when fit-to-page is used.

public int? Scale { get; set; }

Property Value

int?