officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-section-17a7ae22.md
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.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
bool ProtectedForForms { get; set; }
Property ProtectedForForms As Boolean
| Type | Description |
|---|---|
| Boolean |
true if the section is protected for forms; otherwise, false.
|
When a section is protected, you can modify text only in form fields. To protect an entire document, use the Document.Protect method.
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.Docx);
wordProcessor.Document.Sections[0].ProtectedForForms = true;
wordProcessor.Document.Sections[1].ProtectedForForms = false;
wordProcessor.Document.Protect("", DocumentProtectionType.FillInForms);
wordProcessor.SaveDocument("DocumentWithTwoSectionsProtected.docx", DocumentFormat.Docx);
}
Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native
Using wordProcessor = New RichEditDocumentServer()
wordProcessor.LoadDocument("C:\DocumentWithTwoSections.docx", DocumentFormat.Docx)
wordProcessor.Document.Sections(0).ProtectedForForms = True
wordProcessor.Document.Sections(1).ProtectedForForms = False
wordProcessor.Document.Protect("", DocumentProtectionType.FillInForms)
wordProcessor.SaveDocument("DocumentWithTwoSectionsProtected.docx", DocumentFormat.Docx)
End Using
See Also