Products Technologies Demo Docs Blog Support Company

Document Redlining and Approval Workflows with TX Text Control Track Changes in .NET C#

This article shows how to implement a document redlining and approval workflow using TX Text Control .NET Server and ASP.NET Core. The document editor can be used to track changes and to accept or reject changes.

Document Redlining and Approval Workflows with TX Text Control Track Changes in .NET C#

Document redlining or known as track changes is a feature of TX Text Control that allows users to see changes made to a document. This feature is commonly used in collaborative editing scenarios where multiple users are working on the same document. The changes are displayed in a different color and can be accepted or rejected by the user.

Specifically used in legal and medical documents, this feature is a must-have for applications that require document collaboration. Contracts, agreements, and other legal documents are often reviewed by multiple parties and the track changes feature helps to visualize and to keep track of changes made to the document.

This article shows how to enable the track changes feature in TX Text Control and how to accept or reject changes programmatically and how to use the visual components of TX Text Control to visualize and manage changes.

MS Word Compatible

TX Text Control allows you to track changes compatible with MS Word and supports this feature in Office Open XML DOCX, DOC, RTF and other supported formats. Changes made to a document in MS Word or Google Docs are visible and accessible in TX Text Control, so it doesn't matter where the document is being edited - you have full control over the changes made.

The following track change functions are available in TX Text Control:

  • Keep track of text additions and deletions
  • Define current author (user name) for changes
  • Display changes in different colors
  • Display changes in a separate pane
  • Tracking of change, author and time stamp
  • Access, accept or reject changes programmatically
  • Filter changes

Enable Track Changes

To enable track changes in the visual document editor, the following view code is required to set the current author by setting the username:

@using TXTextControl.Web.MVC

@Html.TXTextControl().TextControl(settings =>
        {
            settings.UserNames = new string[] { "Tim Typer" };
            settings.Dock = TXTextControl.Web.DockStyle.Window;
        }).Render()

After setting the current author, the track changes feature can be enabled by toggling the Track Changes toggle button:

Track changes with TX Text Control

Or programmatically by setting the isTrackChangesEnabled property:

TXTextControl.isTrackChangesEnabled = true;

The changes are displayed in a different color and can be accepted or rejected by the user. The sidebar shows the changes and allows the user to navigate through the changes:

Track changes with TX Text Control

Comments can be added to connected tracked changes and can be displayed in the sidebar:

Track changes with TX Text Control

Document Viewer

The Document Viewer can also be used to load a document that contains tracked changes. They will be visualized and a special mode will be active to navigate through the changes to accept or reject them. This is especially helpful in mobile applications where the full-featured editor is not helpful.

The following code shows how to load a document with tracked changes in the Document Viewer:

@using TXTextControl.Web.MVC.DocumentViewer

@Html.TXTextControl().DocumentViewer(settings =>
    {
        settings.DocumentPath = "Data/nda_styled_tracked.tx";
        settings.UserNames = new string[] { "Tim Typer" };
        settings.Dock = DocumentViewerSettings.DockStyle.Window;
    }).Render()

After loading the document, the changes are displayed in the Document Viewer:

Track changes with TX Text Control

The mobile view of the Document Viewer shows the changes and allows the user to navigate through the changes in a dedicated toolbar:

Track changes with TX Text Control

Access Changes Programmatically

TX Text Control provides a powerful API to access, accept or reject changes programmatically. The following code shows how to loop through all changes and to display the change type, author and time stamp:

using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
    tx.Create();
    tx.Load("Data/nda_styled_tracked.tx", TXTextControl.StreamType.InternalUnicodeFormat);

    foreach (TXTextControl.TrackedChange change in tx.TrackedChanges)
    {
        Debug.WriteLine(change.UserName);
        Debug.WriteLine(change.Text);
        Debug.WriteLine(change.ChangeKind);
        Debug.WriteLine(change.ChangeTime);
    }
}

To accept or reject a change, the following code can be used:

using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
    tx.Create();
    tx.Load("Data/nda_styled_tracked.tx", TXTextControl.StreamType.InternalUnicodeFormat);

    TXTextControl.TrackedChange trackedChange = tx.TrackedChanges[0];
    tx.TrackedChanges.Remove(trackedChange, true);
}

The TrackedChangeCollection provides the Remove method with the accept parameter that defines whether the change should be accepted or rejected.

Conclusion

TX Text Control provides a powerful track changes feature that is compatible with MS Word and other word processing applications. This feature is a must-have for applications that require document collaboration and document redlining. The API provides methods to access, accept or reject changes programmatically.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

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.

ASP.NET Core
Angular
Blazor
JavaScript
React
  • Angular
  • Blazor
  • React
  • JavaScript
  • ASP.NET MVC, ASP.NET Core, and WebForms

Learn more Trial token Download trial

Related Posts

ASP.NETAIASP.NET Core

Transforming Legal Review with AI and TX Text Control: A Smarter, Faster…

AI is revolutionizing legal document review by providing faster, more consistent, and cost-effective analysis to help legal professionals identify risks and streamline workflows. TX Text Control…


ASP.NETASP.NET CorePDF/UA

PDF/UA vs. PDF/A-3a: Which Format Should You Use for Your Business Application?

In this blog post, we will explore the differences between PDF/UA and PDF/A-3a, helping you choose the right format for your business needs. We will discuss the key features, benefits, and use…


ASP.NETASP.NET CorePDF/UA

Validating PDF/UA Documents in .NET C#

Creating accessible and compliant PDF documents is becoming an increasingly important requirement across industries. In this blog post, we explore how to validate PDF/UA documents using Text…


ASP.NETASP.NET CoreMarkdown

Bringing MailMerge Power to Markdown: Fluid Placeholders in TX Text Control…

The latest beta version of the TX Text Control Markdown NuGet package introduces support for fluid placeholders, also known as Mustache or Handlebars syntax. This powerful feature enables…


ASP.NETAIASP.NET Core

Automating PDF/UA Accessibility with AI: Describing DOCX Documents Using TX…

This article shows how to use TX Text Control together with the OpenAI API to automatically add descriptive texts (alt text and labels) to images, links, and tables in a DOCX. The resulting…