Document protection
This document function solves the Word function "Restrict editing" via OneOffixx templates. So in OneOffixx templates not the Word function but this document function should be used. The reason for this is that when a Word template is locked in the editor, it can happen that OneOffixx cannot make the necessary adjustments to comply with the corporate design or to fill in the correct profile data.
Word function
The Word function "Restrict editing" is configured and triggered. It can be called in Word via the following button (in the ribbon "Review" as well as "Developer Tools"):
Afterwards this pane opens, which offers some options to restrict editing:
Configuration of the document function
Here is an example configuration:
<Type>AllowOnlyFormFields</Type>
<ShowPasswordDialog>False</ShowPasswordDialog>
<Password></Password>
<NoReset>True</NoReset>
<UseIRM>False</UseIRM>
<EnforceStyleLock>False</EnforceStyleLock>
Type
Here the same setting options are offered as in the pane in Word:
Between <Type>
and </Type>
one of these expressions can be filled in:
AllowOnlyRevisions
– equivalent to "Tracked changes".AllowOnlyComments
– equivalent to "Comments".AllowOnlyFormFields
– equivalent to "Filling in forms".AllowOnlyReading
– equivalent to "No changes (read-only)".
ShowPasswordDialog
Between <ShowPasswordDialog>
and </ShowPasswordDialog>
is written True
or False
. True
means that the Password
must be entered to perform OneOffixx actions on the document. If no Password
is set, the setting is ignored.
Password
Between <Password>
and </Password>
a password can optionally be set. This corresponds to the dialog that appears in Word after selecting the Yes, apply protection now
button in the sidebar:
NoReset
Between <NoReset>
and </NoReset>
is written True
or False
.
True
ensures that form fields keep their content when the document is protected. This setting is applied only if Type
is set to AllowOnlyFormFields
. Otherwise the setting is ignored. Default: False
UseIRM
Between <UseIRM>
and </UseIRM>
True
or False
is written. True means that Information Rights Management (IRM) is used for document protection.
EnforceStyleLock
Between <EnforceStyleLock>
and </EnforceStyleLock>
is written True
or False
. True
means that formatting of text is restricted.
Triggers
The document protection configuration can also be made dependent on settings in the document parameter. This is done by so-called "triggers".
In the XPath
element an XPath expression must be specified which can be true
or false
(see example below). The same XML tree is accessed as for extended bindings – see Library for advanced bindings (Extended bindings).
In the example below, the document parameter checkbox DocParam.TrackRevisions
is accessed.
- If this is checked, the "Revisions" mode is active.
- If this is not checked, there is no document protection.
Here is the example:
<Triggers>
<Trigger>
<XPath>//CheckBox[@id='DocParam.TrackRevisions'] = 'true'</XPath>
<Type>AllowOnlyRevisions</Type>
<ShowPasswordDialog>False</ShowPasswordDialog>
<Password></Password>
<NoReset>True</NoReset>
<UseIRM>False</UseIRM>
<EnforceStyleLock>False</EnforceStyleLock>
</Trigger>
<Trigger>
<XPath>//CheckBox[@id='DocParam.TrackRevisions'] = 'false'</XPath>
<Type>NoProtection</Type>
<ShowPasswordDialog>False</ShowPasswordDialog>
<Password></Password>
<NoReset>True</NoReset>
<UseIRM>False</UseIRM>
<EnforceStyleLock>False</EnforceStyleLock>
</Trigger>
</Triggers>