Skip to main content
A newer version of this page is available. .

XlPageMargins Class

Represents the object that specifies page margins for a worksheet.

Namespace: DevExpress.Export.Xl

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

Declaration

public class XlPageMargins

The following members accept/return XlPageMargins objects:

Remarks

Use the properties of the XlPageMargins object to control the space between the worksheet content and page edges (XlPageMargins.Top, XlPageMargins.Bottom, XlPageMargins.Left and XlPageMargins.Right) and define the distance between a header/footer and the top/bottom edge of a page (XlPageMargins.Header and XlPageMargins.Footer). By default, the margin size is set in inches. To change the unit of margin measurement, use the XlPageMargins.PageUnits property.

To specify margin sizes for a particular worksheet, set the IXlSheet.PageMargins property to the instance of the XlPageMargins class. For an example, refer to the How to: Set Page Margins topic.

Example

Note

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

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 XlPageMargins class.

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.

Inheritance

Object
XlPageMargins
See Also