.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
A newer version of this page is available. Switch to the current version.

Margins Interface

Provides access to page margins used when a worksheet is printed.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.1.Core.dll


public interface Margins


The Margins object is accessible via the WorksheetView.Margins property of the worksheet view that is returned by the Worksheet.ActiveView property.

Page margins are specified in the units of measurement used in the workbook. For details, see the Measure Units topic.


This example demonstrates how to set margins of worksheet pages via properties of the Margins object. To access this object, use the WorksheetView.Margins property of the worksheet view object that is returned by the Worksheet.ActiveView. To select units of measure for worksheet page margins, set the Workbook.Unit property to the required DocumentUnit enumeration member.


The WorksheetView.Margins settings are used when worksheet pages are printed. To learn how to specify other worksheet print options, see the How to: Specify Print Settings document.

// Select a unit of measure used within the workbook.
workbook.Unit = DevExpress.Office.DocumentUnit.Inch;

// Access page margins.
Margins pageMargins = workbook.Worksheets[0].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;
See Also