In DsExcel .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.
C# |
Copy Code |
---|---|
// Set page margins, in points.
worksheet.PageSetup.TopMargin = 36;
worksheet.PageSetup.BottomMargin = 36;
worksheet.PageSetup.RightMargin = 72;
|
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.
C# |
Copy Code |
---|---|
// 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.
C# |
Copy Code |
---|---|
// 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.
C# |
Copy Code |
---|---|
// 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.
C# |
Copy Code |
---|---|
// 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”.
C# |
Copy Code |
---|---|
// Set first page number to auto. worksheet2.PageSetup.IsAutoFirstPageNumber = true; |