Document Protection
Using TX Text Control .NET, 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.
This demo uses the MVC version of TXTextControl.Web included in TX Text Control .NET Server for ASP.NET. The functionality is compatible across all supported platforms.
Version 32.0 SP4
Current user: development@textcontrol.com
This instance of the editor has been initialized with the user development@textcontrol.com who is now able to edit the blue highlighted area and the green area for "Every User". You can change the user using the below drop-down box and confirming with Set User.
If you click the toggle button Enforce Protection to unlock the document, use the password 123 to unlock it.
Sample Source Code
<div class="tx-container"> | |
@{ | |
var user = (Request["user"] == null) | |
? "development@textcontrol.com" : Request["user"]; | |
} | |
@Html.TXTextControl().TextControl(settings => | |
{ | |
settings.ServiceAddress = IPAddress.Parse(System.Configuration.ConfigurationManager.AppSettings["ServiceAddress"]); | |
settings.Dock = DockStyle.Fill; | |
settings.UserNames = new string[] { user }; | |
settings.EditMode = EditMode.ReadOnly | EditMode.UsePassword; | |
}).LoadText(Server.MapPath("~/App_Data/Documents/editing_protected.tx"), | |
StreamType.InternalUnicodeFormat).Render() | |
</div> | |
<div class="form-group col-lg-5 mt-3"> | |
<p>Current user: <strong>@user</strong></p> | |
<select class="form-control mt-3" id="users"> | |
<option value="qa@textcontrol.com">qa@textcontrol.com</option> | |
<option value="development@textcontrol.com">development@textcontrol.com</option> | |
</select> | |
<button onclick="ReloadWithUser()" class="btn btn-success mt-3">Set User</button> | |
</div> |
No code required.
function ReloadWithUser() { | |
window.location = document.location.origin + | |
document.location.pathname + | |
"?user=" + document.getElementById("users").value; | |
} |
No code required.
© 2025 Copyright Text Control GmbH and Text Control, LLC. All rights reserved. We ♥ documents.