Visualize Document Tracked Changes in Web Applications
This sample project shows how to visualize tracked changes in a document.

In order to create new and innovative products, we are working closely with customers to find new ways to work with documents. Mobile devices and sharing platforms change the way how documents are used in business processes. Document collaboration and sharing is one of the major research fields in our development.
Creating documents is an ongoing process and by using software that allows real-time updates and documents to be saved to a central repository in the cloud, different teams can contribute to these documents and work more effectively with ongoing updates.
Text Control provides customizable libraries to integrate document collaboration processes into business applications. Since version X16, MS Word compatible track changes is available as a new feature. TX Text Control enables document collaboration features in applications. Track Changes, also known as redline, or redlining, is a way to keep track of the changes different authors make to a document.
This sample shows how to use the TX Text Control API to visualize tracked changes outside the editor. This could be a useful feature in mobile applications to provide an overview of changes made in a document over a specific period of time.
The following screen video shows this project in action:
In the ASP.NET MVC project, the following model is used to show the tracked changes:
public class TrackedChangeModel
{
public string DocumentName { get; set; }
public DateTime FirstChange { get; set; } = DateTime.MaxValue;
public List<TrackedChange> TrackedChanges { get; set; } = new List<TrackedChange>();
}
public class TrackedChange
{
public string UserName { get; set; }
public DateTime ChangeTime { get; set; }
public string Text { get; set; }
public string HighlightColor { get; set; }
public ChangeKind ChangeKind { get; set; }
public string Image { get; set; }
}
public enum ChangeKind
{
InsertedText = 4096,
DeletedText = 8192
}
For demo purposes, this model is created in the Controller Index method using a ServerTextControl instance that is used to loop through the TXText
public ActionResult Index()
{
// set document name to dummy document
string sDocumentName = Server.MapPath("~/template.docx");
// create a new TrackedChangeModel
TrackedChangeModel model = new TrackedChangeModel() {
DocumentName = sDocumentName
};
// use a temporary ServerTextControl to retrieve the
// changes and to create the thumbnails
using (ServerTextControl tx = new ServerTextControl())
{
tx.Create();
// load the document
tx.Load(sDocumentName, StreamType.WordprocessingML);
// loop through all text parts including headers and footers
foreach (IFormattedText textPart in tx.TextParts)
{
// loop through all changes
foreach (TXTextControl.TrackedChange trackedChange in textPart.TrackedChanges)
{
if (trackedChange.ChangeTime < model.FirstChange) // get first change time stamp
model.FirstChange = trackedChange.ChangeTime;
// create a new TrachedChange object
Models.TrackedChange tc = new Models.TrackedChange()
{
ChangeTime = trackedChange.ChangeTime,
HighlightColor = ColorTranslator.ToHtml(trackedChange.HighlightColor),
ChangeKind = (Models.ChangeKind)trackedChange.ChangeKind,
Text = trackedChange.Text,
UserName = (trackedChange.UserName == "") ? "Unknown User"
: trackedChange.UserName
};
// highlight the change in the document
trackedChange.ScrollTo();
trackedChange.Select();
textPart.Selection.TextBackColor = Color.Yellow;
// create a thumbnail of the page and the highlighted change
tc.Image = ImageToBase64(
tx.GetPages().GetItem().GetImage(100, Page.PageContent.All)
, ImageFormat.Jpeg);
// add the change to the model
model.TrackedChanges.Add(tc);
}
}
}
return View(model);
}
All information that should be visualized are added to the model and finally an image thumbnail of the specific page is created where the tracked change is highlighted. This document page is rendered in the view next to the document history time line.
When hovering over a time line item, the thumbnail image is replaced with the associated image representation.
Try this demo on your own by downloading the project sources from our GitHub repository.
Also See
This post references the following in the documentation:
- TXText
Control. Text Part Collection Class - TXText
Control. Tracked Change Class
Download and Fork This Sample on GitHub
We proudly host our sample code on github.com/TextControl.
Please fork and contribute.
Requirements for this sample
- Visual Studio 2017 or better
- TX Text Control .NET Server (trial sufficient)
ASP.NET
Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.
- Angular
- Blazor
- React
- JavaScript
- ASP.NET MVC, ASP.NET Core, and WebForms
Related Posts
Sneak Peek X18: Form Field Conditional Instructions
In version X18, we will introduce form fields processing functionality to TX Text Control that allows developers to create and deploy forms.
ASP.NETConferenceFuture of Documents
Meet Text Control at NDC London 2019 at QEII in Westminster
We are sponsoring the NDC London 2019 and we will be exhibiting at the QEII in Westminster, London.
User Management Features in TX Text Control
TX Text Control includes a list of user names which is used for document protection and to track changes for multiple authors.
TX Text Control 33.0 SP3 is Now Available: What's New in the Latest Version
TX Text Control 33.0 Service Pack 3 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…
ASP.NETASP.NET CoreDocument Viewer
High-Performance Text Replacement in Large DOCX Files using C# .NET
Learn how to efficiently replace text in large DOCX files using C# .NET and the ServerTextControl component from Text Control. This article demonstrates the performance benefits of using the…