Protecting word processing documents
Leave feedback
On this page
You can protect Word documents with a password or remove protection. Supported protection types:
- AllowOnlyRevisions
- AllowOnlyComments
- AllowOnlyFormFields
- ReadOnly
This sample enables document protection with a specified protection type and password.
import groupdocs.watermark as gw
import groupdocs.watermark.contents.wordprocessing as gwc_wp
load_options = gw.WordProcessingLoadOptions()
with gw.Watermarker("document.docx", load_options) as watermarker:
content = watermarker.get_content(gwc_wp.WordProcessingContent)
content.protect(gwc_wp.WordProcessingProtectionType.READ_ONLY, "7654321")
watermarker.save("document.docx")
This sample removes protection from the document so it can be edited freely.
import groupdocs.watermark as gw
import groupdocs.watermark.contents.wordprocessing as gwc_wp
load_options = gw.WordProcessingLoadOptions()
with gw.Watermarker("document.docx", load_options) as watermarker:
content = watermarker.get_content(gwc_wp.WordProcessingContent)
content.unprotect()
watermarker.save("document.docx")
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.