public class WriteProtection
extends java.lang.Object
implements java.lang.Cloneable
To learn more, visit the Protect or Encrypt a Document documentation article.
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.getWriteProtection() property.
| Modifier and Type | Method and Description |
|---|---|
boolean |
getReadOnlyRecommended()
Specifies whether the document author has recommended that the document be opened as read-only.
|
boolean |
isWriteProtected()
Returns true when a write protection password is set.
|
protected java.lang.Object |
memberwiseClone() |
void |
setPassword(java.lang.String password)
Sets the write protection password for the document.
|
void |
setReadOnlyRecommended(boolean value)
Specifies whether the document author has recommended that the document be opened as read-only.
|
boolean |
validatePassword(java.lang.String password)
Returns true if the specified password is the same as the write-protection password the document was protected with.
|
public boolean getReadOnlyRecommended()
boolean value.public void setReadOnlyRecommended(boolean value)
value - The corresponding boolean value.public void setPassword(java.lang.String password)
If a password is set, Microsoft Word will require the user to enter it or open the document as read-only.
password - The password to set. Cannot be null, but can be an empty string.public boolean validatePassword(java.lang.String password)
public boolean isWriteProtected()
protected java.lang.Object memberwiseClone()