Protection type for a document.
[Visual Basic]
Public Enum ProtectionType
[C#]public enum ProtectionType
Example
Protects a section so only editing in form fields is possible.
[C#]
// Create a blank document
Document doc = new Document();
// Insert two sections with some text
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Section 1. Unprotected.");
builder.InsertBreak(BreakType.SectionBreakContinuous);
builder.Writeln("Section 2. Protected.");
// Section protection only works when document protection is turned and only editing in form fields is allowed.
doc.Protect(ProtectionType.AllowOnlyFormFields);
// By default, all sections are protected, but we can selectively turn protection off.
doc.Sections[0].ProtectedForForms = false;
builder.Document.Save(MyDir + "Section.Protect Out.doc");[Visual Basic]
' Create a blank document
Dim doc As Document = New Document()
' Insert two sections with some text
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
builder.Writeln("Section 1. Unprotected.")
builder.InsertBreak(BreakType.SectionBreakContinuous)
builder.Writeln("Section 2. Protected.")
' Section protection only works when document protection is turned and only editing in form fields is allowed.
doc.Protect(ProtectionType.AllowOnlyFormFields)
' By default, all sections are protected, but we can selectively turn protection off.
doc.Sections(0).ProtectedForForms = False
builder.Document.Save(MyDir & "Section.Protect Out.doc")Members
| Member Name | Description | Value |
| AllowOnlyComments | User can only modify comments in the document. | 1 |
| AllowOnlyFormFields | User can only enter data in the form fields in the document. | 2 |
| AllowOnlyRevisions | User can only add revision marks to the document. | 0 |
| ReadOnly | No changes are allowed to the document. Available since Microsoft Word 2003. | 3 |
| NoProtection | The document is not protected. | -1 |