DocumentProtection Class
Represents a set of document protection restrictions which have been applied to the contents of a document.
- Inheritance:
- System.ObjectDocumentProtection
Remarks
Document protection is a set of restrictions used to prevent unintentional changes to all or part of a document - since this protection does not encrypt the document, malicious applications may circumvent its use. This protection is not intended as a security feature and may be ignored.
Properties
EditingRestriction
Gets or sets the set of editing restrictions which shall be enforced on a given document.
public EditingRestrictionType EditingRestriction { get; set; }
Public Property EditingRestriction As EditingRestrictionType
Property Value
The set of editing restrictions which shall be enforced on a given document.
EnforceEditingRestriction
Gets or sets a value indicating whether document protection settings shall be enforced for a given document.
public bool EnforceEditingRestriction { get; set; }
Public Property EnforceEditingRestriction As Boolean
Property Value
- System.Boolean
true if document protection settings shall be enforced; otherwise, false.
HasPassword
Gets a value indicating whether document protection has password.
Property Value
- System.Boolean
true if document protection has password; otherwise, false.
LimitFormatting
Gets or sets a value indicating whether formatting is limited just to unlocked styles.
Property Value
- System.Boolean
true if formatting is limited just to unlocked styles; otherwise, false.
Methods
SetPassword(String)
Sets the password. If password is null or empty, any existing password will be cleared.
Parameters
password
- System.String
The password.
StartEnforcingProtection(EditingRestrictionType, String)
Starts enforcing protection by restricting document editing actions to those specified by editingRestriction
parameter with optional password which must be specified to stop protection in consumer application such as MS Word.
public void StartEnforcingProtection(EditingRestrictionType editingRestriction, string password)
Public Sub StartEnforcingProtection(editingRestriction As EditingRestrictionType, password As String)
Parameters
editingRestriction
- EditingRestrictionType
The editing restriction enforced upon the document in consumer application such as MS Word.
password
- System.String
The optional password which must be specified to stop protection in consumer application such as MS Word.
StopProtection()
Stops enforcing protection and clears password, if there is any.
ToString()
Returns a System.String that represents this DocumentProtection instance.
Returns
- System.String
A System.String that represents this DocumentProtection instance.
Overrides
Remarks
This method should be used primarily for debugging purposes and should be considered volatile (format of its return value might change in future versions).