Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Document.MarginType Property

Specifies the type of margins used in the document.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v24.2.Core.dll

NuGet Package: DevExpress.RichEdit.Core

#Declaration

MarginType MarginType { get; set; }

#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:

image

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);   
}
See Also