Page tree
Skip to end of metadata
Go to start of metadata

Description

The PageSetup class represents the page layout properties of a printed worksheet.

C#
vb.net

Remarks

To return a PageSetup object, use Worksheet.PageSetup.

Examples

C#
vb.net

Properties

Name

Description

BottomMargin

Sets or returns the value of the worksheet's bottom margin, in inches. This is the space between the worksheet data and the bottom edge of the printed page. This is set to 1 by default. The valid range of values is 0 through 100, and is also limited by the paper size.

CenterFooter

The page PageSetup.CenterFooter could not be found.

CenterHeader

The page PageSetup.CenterHeader could not be found.

CenterHorizontally

Sets or returns whether or not the data of the worksheet is centered horizontally within the margins. This is is set to false by default.

(This is not supported for charts.)

CenterVertically

Sets or returns whether or not the data of the worksheet is centered vertically within the margins. This is is set to false by default.

(This is not supported for charts.)

FirstPageNumber

Sets or returns the first page number for the printed worksheet. By default, the first page number will be 1, or, if the print job does not start with page 1, this will be the number of the first page in the sequence of pages to print. Setting this property will set the FirstPageNumberAuto property to false.

FirstPageNumberAuto

Sets or returns whether Excel should determine the first page number for the printed worksheet. Setting the FirstPageNumber property will set this property to false.

FitToPagesTall

Sets or returns FitToPagesTall. This is set to "auto" by default. The valid range of values is 0 through 32767. A value of 0 means "auto".

(This is not supported for charts.)

FitToPagesWide

Sets or returns FitToPagesWide. This is set to 1 by default. The valid range of values is 0 through 32767. A value of 0 means "auto".

(This is not supported for charts.)

FooterMargin

Sets or returns the value of the footer margin in inches.

HeaderMargin

Sets or returns the value of the header margin in inches. This is the space between the header data and the top edge of the printed page. This is set to 0.5 by default. The valid range of values is 0 through 100, and is also limited by paper size.

LeftFooter

The page PageSetup.LeftFooter could not be found.

LeftHeader

The page PageSetup.LeftHeader could not be found.

LeftMargin

Sets or returns the value of the left margin in inches. This is the space between the worksheet data and the left edge of the printed page. This is set to 0.75 by default. The valid range of values is 0 through 100, and is also limited by paper size.

Orientation

Sets or returns orientation of the printed worksheet.

PaperSize

Sets or returns the paper size that will be used when Excel renders and prints the worksheet.

PrintArea

Sets or returns the area of the worksheet that will be printed. Content outside of this area will not be printed.

(This is not supported for charts.)

PrintAsDraft

Sets or returns whether Excel will print the worksheet in draft quality. This can be used to reduce printing time. When this is set to true, Excel does not print gridlines and most graphics. This is set to false by default.

PrintCellErrorsAs

Sets or returns how cell errors will appear on the printed worksheet.

(This is not supported for charts.)

PrintComments

Sets or returns whether comments on the worksheet should be printed.

(This is not supported for charts.)

PrintCommentsAtEnd

Sets or returns whether comments will be printed at the end of the worksheet, or if they will be printed as they are displayed. If set to true, comments will be printed at the end.

(This is not supported for charts.)

PrintGridlines

Sets or returns whether the worksheet's horizontal and vertical cell gridlines will be printed.

(This is not supported for charts.)

PrintHeadings

Sets or returns whether the row and column headings will be printed for this worksheet.

(This is not supported for charts.)

PrintInBlackAndWhite

Sets or returns whether a worksheet formatted with colors will be printed in black and white. Set this to true if you are printing a colored worksheet on a black and white printer, or to reduce printing time on a color printer.

PrintOrder

Sets or returns the order in which data is numbered and printed when it does not fit on one page. The default order is down-then-over.

(This is not supported for charts.)

PrintTitles

Returns the Range of cells that contains the print titles. This range will contain up to two Area s, one for print title rows and another for the print title columns. These are the rows and columns that will be repeated on each printed page.

(This is not supported for charts.)

RightFooter

The page PageSetup.RightFooter could not be found.

RightHeader

The page PageSetup.RightHeader could not be found.

RightMargin

Sets or returns the value of the right margin in inches. This is the space between the worksheet data and the right edge of the printed page. This is set to.75 by default. The valid range of values is 0 through 100, and is also limited by paper size.

TopMargin

Sets or returns the value for the top margin in inches. This is the space between the worksheet data and the top edge of the printed page. This is set to 1 by default. The valid range of values are 0 through 100, and is also limited by paper size.

UseZoom

Sets or returns whether the Zoom property or the FitToPagesTall and FitToPagesWide pair of properties will be used.

(This is not supported for charts.)

Zoom

Sets or returns the percentage by which the size of the printed worksheet is adjusted. The printed worksheet can be enlarged up to 400%, and reduced to 10%.

(This is not supported for charts.)

Methods

Name

Description

GetFooter(HeaderFooterSection.Section)

Returns a section of the footer.

GetHeader(HeaderFooterSection.Section)

Returns a section of the header.

SetPrintTitleColumns(Int32, Int32)

Sets the columns to use for the print titles. These are the columns that will be repeated on each page of a printed worksheet.

(This is not supported for charts.)

SetPrintTitleRows(Int32, Int32)

Sets the rows to use for the print titles. These are the rows that will be repeated on each page of a printed worksheet.

(This is not supported for charts.)

Nested Classes

Name

Description

CellErrorsAs

A CellErrorsAs value determines how cell errors will appear in the printed worksheet.

PageOrientation

PageOrientation specifies the page orientation of the printed worksheet.

PagePaperSize

PagePaperSize specifies the paper size for printing.

PagePrintOrder

PagePrintOrder specifies the order in which a worksheet should be printed.
  • No labels