WriteProtection class

WriteProtection class

Specifies write protection settings for a document. To learn more, visit the Protect or Encrypt a Document documentation article.

Remarks

Write protection specifies whether the author has recommended that the document is to be opened as read-only and/or require a password to modify a document.

Write protection is different from document protection. Write protection is specified in Microsoft Word in the options of the Save As dialog box.

You do not create instances of this class directly. You access document protection settings via the Document.writeProtection property.

Properties

NameDescription
isWriteProtectedReturns true when a write protection password is set.
readOnlyRecommendedSpecifies whether the document author has recommended that the document be opened as read-only.

Methods

NameDescription
setPassword(password)Sets the write protection password for the document.
validatePassword(password)Returns true if the specified password is the same as the write-protection password the document was protected with. If document is not write-protected with password then returns false.

See Also