Skip to main content
All docs
V25.1
  • Document.MarginType Property

    Specifies the type of margins used in the document.

    Namespace: DevExpress.XtraRichEdit.API.Native

    Assembly: DevExpress.RichEdit.v25.1.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.Docx);   
    }
    
    See Also