# Configure Page Settings

Work with DsExcel to configure the page margins, page orientation, page order, page center, and first page number.

## Content

In DsExcel .NET, you can use the properties of the [IPageSetup interface](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IPageSetup.html) in order to configure page settings.
Configuring page settings involves the following tasks:

1. [Configure Page Margins](/document-solutions/dot-net-excel-api/docs/online/Features/print/ConfigurePrintSettingsviaPageSetup/ConfigurePageSettings#configure-page-margins)
2. [Configure Page Orientation](/document-solutions/dot-net-excel-api/docs/online/Features/print/ConfigurePrintSettingsviaPageSetup/ConfigurePageSettings#configure-page-orientation)
3. [Configure Page Order](/document-solutions/dot-net-excel-api/docs/online/Features/print/ConfigurePrintSettingsviaPageSetup/ConfigurePageSettings#configure-page-order)
4. [Configure Page Center](/document-solutions/dot-net-excel-api/docs/online/Features/print/ConfigurePrintSettingsviaPageSetup/ConfigurePageSettings#configure-page-center)
5. [Configure First Page Number](/document-solutions/dot-net-excel-api/docs/online/Features/print/ConfigurePrintSettingsviaPageSetup/ConfigurePageSettings#configure-first-page-number)

## Configure Page Margins

You can use the [TopMargin property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IPageSetup.TopMargin.html), [RightMargin property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IPageSetup.RightMargin.html) and [BottomMargin property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IPageSetup.BottomMargin.html) of the IPageSetup interface in order to configure margins for a page.

```csharp
// Set page margins, in points.
worksheet.PageSetup.TopMargin = 36;
worksheet.PageSetup.BottomMargin = 36;
worksheet.PageSetup.RightMargin = 72;
```

> !type=note
> **Note:** While you set margins for your page, it is necessary to ensure that it should not be less than Zero.

## Configure Page Orientation

You can use the [Orientation property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IPageSetup.Orientation.html) of the IPageSetup interface in order to set the orientation for a page to Portrait or Landscape as per your preferences.

```csharp
// Set page orientation. 
worksheet.PageSetup.Orientation = PageOrientation.Landscape;
```

## Configure Page Order

You can use the [Order property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IPageSetup.Order.html) of the IPageSetup interface in order to configure the order of the page as per your choice.

```csharp
// Set page order. The default value is DownThenOver.
 worksheet.PageSetup.Order = Order.OverThenDown;
```

## Configure Page Center

You can use the [CenterHorizontally property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IPageSetup.CenterHorizontally.html) and the [CenterVertically property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IPageSetup.CenterVertically.html) of the IPageSetup interface in order to configure the center of your page according to your preferences.

```csharp
// Set center. The default value is false.
worksheet.PageSetup.CenterHorizontally = true;
worksheet.PageSetup.CenterVertically = true;
```

## Configure First Page Number

You can use the [FirstPageNumber property](/document-solutions/dot-net-excel-api/api/online/DS.Documents.Excel/GrapeCity.Documents.Excel.IPageSetup.FirstPageNumber.html) of the IPageSetup interface in order to configure the number for your first page as per your choice.

```csharp
// 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”.

```csharp
// Set first page number to auto.
worksheet2.PageSetup.IsAutoFirstPageNumber = true;
```