phpword Document protection on parts of document

42 Views Asked by At

phpword documentation says:

The document (or parts of it) can be password protected.

$documentProtection = $phpWord->getSettings()->getDocumentProtection();
$documentProtection->setEditing(DocProtect::READ_ONLY);
$documentProtection->setPassword('myPassword');

Using this only formfields, checkboxes and dropdown can be choosed.

I need docx with formfields. I use

$documentProtection->setEditing(DocProtect::FORMS);

This works fine.

But my users must be able to copy text not included in formfields. So they must be able to choose other parts of docx.

All important parts to protect I put in a table. How do I protect table? Or any other part of document? THX

Searching the web. Seems nearly likable question here: How to implement Document protection for a part of the Document? trying to change code with try an error.

0

There are 0 best solutions below