XmlApi - pdx:protectDocx

pdx:protectDocx

Password protects the contents of a Word document.

Description

Element definition

This element allows to password protect a Word document. One may protect in read only mode or allow the final user to modify comments or form elements.

Notice that this element does not encrypt the contents of the Word document, only protects them from unauthorized modifications. This element is not secure and can be easily overridden by an experienced user.

Attributes and sub-elements

src

Path to the word document you want to protect.

target

Path to the resulting protected document.

password

The password should be a string of 15 or less characters. If you introduce a password with more than 15 characters it will be automatically truncated.

type

Available protection types: readOnly (allows no editing. This is the default value), comments (allows the edition of comments), trackedChanges (allows editing with revision tracking) and forms (allows the edition of form fields).

Code samples

Example #1

config.xml

content.xml

settings.xml

PHP code

The resulting Word document looks like: