Skip to main content

XlPageMargins.PageUnits Property

Gets or sets the unit of margin measurement.

Namespace: DevExpress.Export.Xl

Assembly: DevExpress.Printing.v24.1.Core.dll

NuGet Package: DevExpress.Printing.Core

Declaration

public XlPageUnits PageUnits { get; set; }

Property Value

Type Description
XlPageUnits

An XlPageUnits enumeration value that specifies the unit of measurement for worksheet margins.

The default is XlPageUnits.Inches.

Available values:

Name Description
Inches

Specifies inches as a unit of margin measurement.

Centimeters

Specifies centimeters as a unit of margin measurement.

Remarks

Use the PageUnits property to set the unit of margin measurement to the desired value: inches or centimeters.

Example

Note

A complete sample project is available at https://github.com/DevExpress-Examples/excel-export-api-examples

sheet.PageMargins = new XlPageMargins();
// Set the unit of margin measurement.
sheet.PageMargins.PageUnits = XlPageUnits.Centimeters;
// Specify page margins.
sheet.PageMargins.Left = 2.0;
sheet.PageMargins.Right = 1.0;
sheet.PageMargins.Top = 1.25;
sheet.PageMargins.Bottom = 1.25;
// Specify header and footer margins.
sheet.PageMargins.Header = 0.7;
sheet.PageMargins.Footer = 0.7;

The following code snippets (auto-collected from DevExpress Examples) contain references to the PageUnits property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also