Click or drag to resize

ProtectionType Enumeration

Protection type for a document.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
public enum ProtectionType
  Member nameValueDescription
AllowOnlyComments1 User can only modify comments in the document.
AllowOnlyFormFields2 User can only enter data in the form fields in the document.
AllowOnlyRevisions0 User can only add revision marks to the document.
ReadOnly3 No changes are allowed to the document. Available since Microsoft Word 2003.
NoProtection-1 The document is not protected.
Protects a section so only editing in form fields is possible.
// 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.Writeln("Section 2. Protected.");

// Section protection only works when document protection is turned and only editing in form fields is allowed

// By default, all sections are protected, but we can selectively turn protection off
doc.Sections[0].ProtectedForForms = false;

builder.Document.Save(ArtifactsDir + "Section.Protect.doc");
See Also