TX Text Control allows you to protect documents with specific permissions and to protect documents from editing and formatting actions. Typically, a document is protected, exceptions are applied for specific users and the document is encrypted with a password. When opening such a document with TX Text Control without providing the master password, the permissions are applied and the document is protected automatically when the TXTextControl.TextControl.EditMode property ╰ TX Text Control .NET for Windows Forms
╰ TXTextControl Namespace
╰ TextControl Class
╰ EditMode Property
Gets or sets a value indicating whether the document's text is protected, or can be freely edited and formatted. is set to ReadAndSelect.
But the document permissions can be also used without encrypting the document. The following code shows how to prevent users from making formatting changes. The document content can be changed, but formatting actions are not allowed:
If you want to save the permission settings in the document, the EditMode property must be set to ReadAndSelect and UsePassword. The document is then encrypted and the permissions are stored in the document.
If this document is re-opened and and the EditMode is set to ReadAndSelect, the permissions are automatically applied:
The included ribbon bar of TX Text Control is reflecting these document permissions automatically. After reloading the document into TX Text Control, the formatting options are disabled:
The document master password can also be set programmatically when loading the document. The following code shows how to save a read-only document with formatting restrictions:
If this document is loaded without passing a password, the document cannot be edited or formatted. But if the document is opened with the correct master password, these restrictions are suspended:
If you want to learn more about document protection, these 2 articles explain the basics of document protection: