NativeExcel for .Net Developer's Reference

IPageSetup Interface

Represents the page setup description. The IPageSetup interface contains all page setup attributes (margins, headers, footers, paper size, and so on) as properties.

For a list of all members of this type, see IPageSetup Members.

[Visual Basic]
PublicInterfaceIPageSetup
[C#]
publicinterfaceIPageSetup
[C++]
public__gc__interfaceIPageSetup
[JScript]
publicinterfaceIPageSetup

Remarks

Use PageSetup property to return IPageSetup interface

Example

This example changes the page settings for each sheet on workbook

[C#]
for (int i = 1; i <= book.WorkWorksheets.Count; i++) {
    IPageSetup page = book.Worksheets[i].PageSetup;
    page.Orientation = XlPageOrientation.xlLandscape;
    page.PaperSize = XlPaperSize.xlPaperLegal;
    page.CenterHeader = "&D page &P of &N";
}
[VisualBasic]
Dim page As IPageSetup
Dim i As Integer = 1
While i <= book.Worksheets.Count
    page = book.Worksheets(i).PageSetup
    page.Orientation = XlPageOrientation.xlLandscape
    page.PaperSize = XlPaperSize.xlPaperLegal
    page.CenterHeader = "&D page &P of &N"
    i = i + 1
End While    
[C++]
for (int i = 1; i <= book->Worksheets->Count; i++) {
    IPageSetup* page = book->Worksheets->Item[i]->PageSetup;
    page->Orientation = XlPageOrientation::xlLandscape;
    page->PaperSize = XlPaperSize::xlPaperLegal;
    page->CenterHeader = S"&D page &P of &N";
}

Requirements

Namespace: NativeExcel

Assembly: NativeExcel (in NativeExcel.dll)

See Also

IPageSetup Members | NativeExcel Namespace | PageSetup Property