officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-document-177574f3.md
Specifies the type of margins used in the document.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
MarginType MarginType { get; set; }
Property MarginType As MarginType
| Type | Description |
|---|---|
| MarginType |
An enumeration value that indicates the margin type.
|
Available values:
| Name | Description |
|---|---|
| Normal |
Normal margins
| | Mirrored |
Mirrored margins.
|
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.
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.Docx);
}
Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native
Imports DevExpress.Office.Utils
Using wordProcessor = New RichEditDocumentServer()
wordProcessor.LoadDocument("Documents//Alice.docx")
Dim document As Document = wordProcessor.Document
' Enable mirrored margins
document.MarginsType = MarginsType.Mirrored
For Each section As Section In wordProcessor.Document.Sections
Dim pageMargins = section.Margins
' Set the value for mirrored margins
pageMargins.Gutter = Units.InchesToDocumentsF(0.5F)
Next section
wordProcessor.SaveDocument("Alice_formatted.docx", DocumentFormat.Docx)
End Using
See Also