Document.MarginType Property
Specifies the type of margins used in the document.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v24.1.Core.dll
NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation
Declaration
Property Value
Type | Description |
---|---|
MarginType | An enumeration value that indicates the margin type. |
Available values:
Name | Description |
---|---|
Normal | Normal margins |
Mirrored | Mirrored margins. |
Remarks
The MarginType
property defines the margin type: regular or mirrored. Mirrored margins add extra space to inside and outside margins of facing pages to create a symmetrical appearance.
The SectionMargins.Gutter property specifies the mirror margin value. When the MarginsType
property is set to Mirrored
, the SectionMargins.GutterPosition
property is ignored.
Example
The following code sample enables mirrored margins and specifies an additional space value:
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
using DevExpress.Office.Utils;
using (var wordProcessor = new RichEditDocumentServer())
{
wordProcessor.LoadDocument(@"Documents//Alice.docx");
Document document = wordProcessor.Document;
// Enable mirrored margins
document.MarginsType = MarginsType.Mirrored;
foreach (Section section in wordProcessor.Document.Sections)
{
var pageMargins = section.Margins;
// Set the value for mirrored margins
pageMargins.Gutter = Units.InchesToDocumentsF(0.5f);
}
wordProcessor.SaveDocument("Alice_formatted.docx", DocumentFormat.OpenXml);
}