Skip to main content
All docs
V24.1

Section.ProtectedForForms Property

Gets or sets whether a section is protected for forms (section content is read-only except for form fields).

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation

Declaration

bool ProtectedForForms { get; set; }

Property Value

Type Description
Boolean

true if the section is protected for forms; otherwise, false.

Remarks

When a section is protected, you can modify text only in form fields. To protect an entire document, use the Document.Protect method.

Example

The following code snippet loads a document with two sections, turns on form protection for the first section in the document, unprotects the second section, and saves the updated document.

using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;

using (var wordProcessor = new RichEditDocumentServer()) {
    wordProcessor.LoadDocument(@"C:\DocumentWithTwoSections.docx", DocumentFormat.OpenXml);
    wordProcessor.Document.Sections[0].ProtectedForForms = true;
    wordProcessor.Document.Sections[1].ProtectedForForms = false;
    wordProcessor.Document.Protect("", DocumentProtectionType.FillInForms);
    wordProcessor.SaveDocument("DocumentWithTwoSectionsProtected.docx", DocumentFormat.OpenXml);
}
See Also