public final class ProtectionManager extends java.lang.Object implements IProtectionManager
Presentation password protection management.
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkWriteProtection(java.lang.String password)
Determines whether a presentation is a password protected to modify.
|
void |
encrypt(java.lang.String encryptionPassword)
Encrypts Presentation with specified password.
|
boolean |
getEncryptDocumentProperties()
This property makes sense, if presentation is password protected.
|
java.lang.String |
getEncryptionPassword()
Gets the password which is used for presentation encryption.
|
boolean |
getReadOnlyRecommended()
Gets or sets read-only recommendation.
|
boolean |
isEncrypted()
Gets a value indicating whether this instance is encrypted.
|
boolean |
isOnlyDocumentPropertiesLoaded()
This property makes sense, if presentation file is password protected and document
properties of this file are public.
|
boolean |
isWriteProtected()
Gets a value indicating whether this presentation is write protected.
|
void |
removeEncryption()
Removes the encryption.
|
void |
removeWriteProtection()
Removes write protection for this presentation.
|
void |
setEncryptDocumentProperties(boolean value)
This property makes sense, if presentation is password protected.
|
void |
setReadOnlyRecommended(boolean value)
Gets or sets read-only recommendation.
|
void |
setWriteProtection(java.lang.String password)
Set write protection for this presentation with specified password.
|
public final boolean getEncryptDocumentProperties()
This property makes sense, if presentation is password protected.
If true then document properties is encrypted in presentation file.
If false then document properties is public while presentation is encrypted.
Read/write boolean.
getEncryptDocumentProperties in interface IProtectionManagerpublic final void setEncryptDocumentProperties(boolean value)
This property makes sense, if presentation is password protected.
If true then document properties is encrypted in presentation file.
If false then document properties is public while presentation is encrypted.
Read/write boolean.
setEncryptDocumentProperties in interface IProtectionManagerpublic final boolean isEncrypted()
Gets a value indicating whether this instance is encrypted.
Read-only boolean.
encrypt(String)
method was called ; otherwise, false.isEncrypted in interface IProtectionManagerpublic final boolean isOnlyDocumentPropertiesLoaded()
This property makes sense, if presentation file is password protected and document
properties of this file are public.
Value of true means that only document properties are loaded from an encrypted
presentation file without use of password.
Value of false means that entire encrypted presentation is loaded with use of right
password, not only document properties are loaded.
If presentation isn't encrypted then property value is always false.
If document properties of an encrypted file aren't public then property value is always false.
If Presentation.EncryptDocumentProperties is true than IsOnlyDocumentPropertiesLoaded
property value is always false.
Read-only boolean.
isOnlyDocumentPropertiesLoaded in interface IProtectionManagerpublic final boolean isWriteProtected()
Gets a value indicating whether this presentation is write protected.
Read-only boolean.
isWriteProtected in interface IProtectionManagerpublic final void encrypt(java.lang.String encryptionPassword)
Encrypts Presentation with specified password.
The following sample code shows you how to encrypt a PowerPoint Presentation.Presentation pres = new Presentation("pres.pptx"); try { pres.getProtectionManager().encrypt("123123"); pres.save("encrypted-pres.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
encrypt in interface IProtectionManagerencryptionPassword - The password.public final void removeEncryption()
Removes the encryption.
removeEncryption in interface IProtectionManagerpublic final void setWriteProtection(java.lang.String password)
Set write protection for this presentation with specified password.
The following sample code shows you how to set a write protection to a presentation.Presentation pres = new Presentation("pres.pptx"); try { pres.getProtectionManager().setWriteProtection("123123"); pres.save("write-protected-pres.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
setWriteProtection in interface IProtectionManagerpassword - The password.public final void removeWriteProtection()
Removes write protection for this presentation.
This sample code shows you how to remove the write protection from a PowerPoint Presentation.Presentation pres = new Presentation("pres.pptx"); try { pres.getProtectionManager().removeWriteProtection(); pres.save("write-protection-removed.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
removeWriteProtection in interface IProtectionManagerpublic final boolean checkWriteProtection(java.lang.String password)
Determines whether a presentation is a password protected to modify.
Presentation presentation = new Presentation(presentationFilePath); try { boolean isWriteProtected = presentation.getProtectionManager().checkWriteProtection("my_password"); } finally { if (presentation != null) presentation.dispose(); }
checkWriteProtection in interface IProtectionManagerpassword - The password for checking.
isWriteProtected()) property before calling this method.
2. When the password is null or empty, this method returns false.
public final java.lang.String getEncryptionPassword()
Gets the password which is used for presentation encryption.
Read-only String.
getEncryptionPassword in interface IProtectionManagerpublic final boolean getReadOnlyRecommended()
Gets or sets read-only recommendation.
Read/write boolean.
Presentation pres = new Presentation(); try { pres.getProtectionManager().setReadOnlyRecommended(true); pres.save("ReadOnlyPresentation.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
getReadOnlyRecommended in interface IProtectionManagerpublic final void setReadOnlyRecommended(boolean value)
Gets or sets read-only recommendation.
Read/write boolean.
Presentation pres = new Presentation(); try { pres.getProtectionManager().setReadOnlyRecommended(true); pres.save("ReadOnlyPresentation.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
setReadOnlyRecommended in interface IProtectionManagerCopyright © 2004-2025 Aspose Pty Ltd. All Rights Reserved.