Since version X16, TX Text Control provides a way to track changes in documents made by multiple authors to enable document collaboration.

The TXTextControl.TrackedChange class TX Text Control .NET for Windows Forms
TXTextControl Namespace
TrackedChange Class
A TrackedChange object represents a change made to the document after anyone has revised the document.
represents a change made to the document after anyone has revised the document. It returns the TXTextControl.TrackedChange.UserName property TX Text Control .NET for Windows Forms
TXTextControl Namespace
TrackedChange Class
UserName Property
Gets the name of the user who has changed the document.
, time stamps, the kind of the change and the content.

In order to accept or reject a tracked change, the specific change needs to be removed from the TXTextControl.TrackedChangeCollection class TX Text Control .NET for Windows Forms
TXTextControl Namespace
TrackedChangeCollection Class
Contains all tracked changes in the main text or another part of a document.
using the TXTextControl.TrackedChangeCollection.Remove method TX Text Control .NET for Windows Forms
TXTextControl Namespace
TrackedChangeCollection Class
Remove Method
Removes a tracked change from the collection.
.

Sometimes, it is required to remove all changes from the whole document by a given Username. For this purpose, we implemented two extension methods. Extension methods enable you to add additional functionality to existing classes.

The following extension methods remove all changes from the TrackedChangeCollection or all changes from all TextParts:

namespace TrackedChangeCollectionExtensions
{
public static class TrackedChangeCollectionExtensions
{
// removes all changes in the TrackedChangeCollection with a given username
public static int RemoveAll(
this TXTextControl.TrackedChangeCollection trackdChangeCollection,
string username, bool accept)
{
List<TrackedChange> myTrackedChanges = new List<TrackedChange>();
// loop through all changes
foreach (TXTextControl.TrackedChange trackedChange in trackdChangeCollection)
{
if (trackedChange.UserName == username)
myTrackedChanges.Add(trackedChange);
}
// delete all changes
foreach (TrackedChange listedTrackedChange in myTrackedChanges)
trackdChangeCollection.Remove(listedTrackedChange, true);
return myTrackedChanges.Count;
}
// removes all changes in all TextParts with a given username
public static int RemoveAllTrackedChanges(
this TXTextControl.TextPartCollection textPartCollection,
string username, bool accept)
{
// counter
var deletedTrackedChanges = 0;
// loop through all text parts
foreach (IFormattedText textPart in textPartCollection)
{
List<TrackedChange> myTrackedChanges = new List<TrackedChange>();
// loop through all changes
foreach (TXTextControl.TrackedChange trackedChange in textPart.TrackedChanges)
{
if (trackedChange.UserName == username)
myTrackedChanges.Add(trackedChange);
}
// delete all changes
foreach (TrackedChange listedTrackedChange in myTrackedChanges)
{
textPart.TrackedChanges.Remove(listedTrackedChange, true);
deletedTrackedChanges++;
}
}
return deletedTrackedChanges;
}
}
}

In order to accept all changes made by the user development@devteam.com, only the following call is required:

var removedChanges = textControl1.TrackedChanges.RemoveAll("development@devteam.com", true);
view raw data.cs hosted with ❤ by GitHub

If you need to reject all changed in all text parts including the header, footer, main text and text frames, the following call can be used:

var removedChanges =
textControl1.TextParts.RemoveAllTrackedChanges("development@devteam.com", false);
view raw data.cs hosted with ❤ by GitHub

If you did not try version X16 already, please download a trial version and test this on your own.