Provides access to page margins used when a worksheet is printed.
The Margins object is accessible via the Worksheet.ActiveView.Margins property.
Page margins are specified in the units of measurement used in the workbook. See the following topic for details: Measure Units.
This example demonstrates how to set margins of worksheet pages via properties of the
Margins object. Use the Worksheet.ActiveView.Margins property to return this object.
To select units of measure for worksheet page margins, set the Workbook.Unit property to the required DocumentUnit enumeration member.
// Select a unit of measure used within the workbook. workbook.Unit = DevExpress.Office.DocumentUnit.Inch; // Access page margins. Margins pageMargins = workbook.Worksheets.ActiveView.Margins; // Specify page margins. pageMargins.Left = 1; pageMargins.Top = 1.5F; pageMargins.Right = 1; pageMargins.Bottom = 0.8F; // Specify header and footer margins. pageMargins.Header = 1; pageMargins.Footer = 0.4F;
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Margins interface.
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.