com.aspose.words
Class ProtectionType

java.lang.Object
    extended by com.aspose.words.ProtectionType

public class ProtectionType 
extends java.lang.Object

Utility class containing constants. Protection type for a document.

Example:

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.insertBreak(BreakType.SECTION_BREAK_CONTINUOUS);
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.ALLOW_ONLY_FORM_FIELDS);

// By default, all sections are protected, but we can selectively turn protection off.
doc.getSections().get(0).setProtectedForForms(false);

builder.getDocument().save(getMyDir() + "Section.Protect Out.doc");

Field Summary
static final intALLOW_ONLY_COMMENTS = 1
           User can only modify comments in the document.
static final intALLOW_ONLY_FORM_FIELDS = 2
           User can only enter data in the form fields in the document.
static final intALLOW_ONLY_REVISIONS = 0
           User can only add revision marks to the document.
static final intREAD_ONLY = 3
           No changes are allowed to the document. Available since Microsoft Word 2003.
static final intNO_PROTECTION = -1
           The document is not protected.
 

Field Detail

ALLOW_ONLY_COMMENTS = 1

public static final int ALLOW_ONLY_COMMENTS
User can only modify comments in the document.

ALLOW_ONLY_FORM_FIELDS = 2

public static final int ALLOW_ONLY_FORM_FIELDS
User can only enter data in the form fields in the document.

ALLOW_ONLY_REVISIONS = 0

public static final int ALLOW_ONLY_REVISIONS
User can only add revision marks to the document.

READ_ONLY = 3

public static final int READ_ONLY
No changes are allowed to the document. Available since Microsoft Word 2003.

NO_PROTECTION = -1

public static final int NO_PROTECTION
The document is not protected.

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.