protect method
Leave feedback
On this page
Protects the document from changes and sets a protection password.
To have the content of the document editable, use the appropriate method of adding a watermark with WordProcessingLockType.allow_only_form_fields or WordProcessingLockType.read_only_with_editable_content parameter.
def protect(self, protection_type, password):
...
| Parameter | Type | Description |
|---|---|---|
| protection_type | WordProcessingProtectionType |
Specifies the protection type for the document. |
| password | str |
The password to protect the document with. |
from groupdocs.watermark import Watermarker
from groupdocs.watermark.options.word_processing import WordProcessingLoadOptions
from groupdocs.watermark.contents.word_processing import WordProcessingProtectionType
def protect_document():
with Watermarker("./document.docx", WordProcessingLoadOptions()) as watermarker:
content = watermarker.get_content()
content.protect(WordProcessingProtectionType.READ_ONLY, "p@ssw0rd")
watermarker.save("./output.docx")
- class
WordProcessingContent
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.