Using TX Text Control X15, documents can be protected by restricting the formatting and editing of content. When protecting a document, it is possible to define whether the document is completely locked or formatting can be applied.

Technically, the document gets encrypted with a password. When this encrypted document is loaded, it is restricted or set to read-only. In order to edit the document, the password needs to be entered.

Document protection diagram

The following code sets the TXTextControl.TextControl.EditMode property to UsePassword which can be only combined with EditMode.ReadAndSelect using the bitwise or operator.


When the document is loaded and the EditMode property is set to Edit, a dialog box to enter a password is opened automatically:


If the entered password matches the password that has been used to encrypt the document, the document can be edited again.

Editable regions are exceptions within protected documents to provide specific users permissions to edit these regions while the rest of the document is read-only.

How these regions can be inserted and how to define the current user will be explained in one of the next blog entries. Stay tuned!