[]
In GcExcel .NET, you can use the properties of the IPageSetup interface in order to configure page settings.
Configuring page settings involves the following tasks:
You can use the TopMargin property, RightMargin property and BottomMargin property of the IPageSetup interface in order to configure margins for a page.
//Set page margins, in points.
worksheet.PageSetup.TopMargin = 36;
worksheet.PageSetup.BottomMargin = 36;
worksheet.PageSetup.RightMargin = 72;
Note: While you set margins for your page, it is necessary to ensure that it should not be less than Zero.
You can use the Orientation property of the IPageSetup interface in order to set the orientation for a page to Portrait or Landscape as per your preferences.
//Set page orientation.
worksheet.PageSetup.Orientation = PageOrientation.Landscape;
You can use the Order property of the IPageSetup interface in order to configure the order of the page as per your choice.
//Set page order. The default value is DownThenOver.
worksheet.PageSetup.Order = Order.OverThenDown;
You can use the CenterHorizontally property and the CenterVertically property of the IPageSetup interface in order to configure the center of your page according to your preferences.
//Set center. The default value is false.
worksheet.PageSetup.CenterHorizontally = true;
worksheet.PageSetup.CenterVertically = true;
You can use the FirstPageNumber property of the IPageSetup interface in order to configure the number for your first page as per your choice.
//Set first page number. The default value is p1.
worksheet.PageSetup.FirstPageNumber = 3;
You can also use IsAutoFirstPageNumber property of the IPageSetup interface to set the first page number to “Auto”.
// Set first page number to auto.
worksheet2.PageSetup.IsAutoFirstPageNumber = true;