Expand Minimize

WorksheetBase.PageSetup Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets a Microsoft.Office.Interop.Excel.PageSetup that contains all the page setup settings for the worksheet.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

public PageSetup PageSetup { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.PageSetup
A Microsoft.Office.Interop.Excel.PageSetup that contains all the page setup settings for the worksheet.

The following code example uses the PageSetup property to set the bottom and header margins, the first page number, and the center headers and footers of the worksheet.

This example is for a document-level customization.

private void AdjustPageFormat()
{
    this.PageSetup.BottomMargin = 10;
    this.PageSetup.FirstPageNumber = 1;
    this.PageSetup.HeaderMargin = 10;
    this.PageSetup.CenterHeader = "December Sales Forcasts";
    this.PageSetup.CenterFooter = DateTime.Now.ToShortDateString();

    // Enter a range value and then preview the worksheet to  
    // display the page setup changes. 
    this.Range["A1", "A5"].Value2 = "Sales";
    this.PrintPreview(false);
}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft