Table of Contents
Manage document editing restrictions and password protection.
2. Subcommands
| Subcommand | Description |
|---|---|
|
Apply editing restriction to the document |
|
Remove all protection from the document |
|
Display current protection status |
3. Protection types
| Type | Description |
|---|---|
|
No edits allowed |
|
Only comments allowed |
|
Only tracked changes allowed |
|
Only form fields editable |
5. Examples
Apply read-only protection:
uniword protect apply document.docx --type read_only -o protected.docx
Apply with password:
uniword protect apply document.docx --type comments --password secret -o out.docx
Check protection:
uniword protect info document.docx
Remove protection:
uniword protect remove document.docx -o unprotected.docx
6. Ruby API
doc = Uniword.load("document.docx")
# Apply protection
doc.protect(:read_only, password: "secret").save("protected.docx")
doc.protect(:tracked_changes).save("tracked.docx")
# Check status
doc.protection_active? # => true/false
doc.protection_info # => { type: :read_only, password_protected: true }
# Remove
doc.unprotect.save("unprotected.docx")