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] Public Interface IPageSetup [C#] public interface IPageSetup [C++] public __gc __interface IPageSetup [JScript] public interface IPageSetup
Use PageSetup property to return IPageSetup interface
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";
}
[Visual Basic]
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";
}
Namespace: NativeExcel
Assembly: NativeExcel (in NativeExcel.dll)
IPageSetup Members | NativeExcel Namespace | PageSetup Property