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

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.2.Core.dll

NuGet Package: DevExpress.RichEdit.Core

#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