We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Read all the track changes(Insertion, Deletion, Format_change) values with Before and AfterText from word documents-C#

Hi Aspose Team,

I want to read all the track changes(Insertion, Deletion, Format_change) values from word documents.
Whatever i have seen in the Word document from MS-Office application, the same number of revisions and values from Aspose output. But i am not getting the same results from aspose api.
Our requirement is to get the Beforetext and Aftertext for Insertion, Deletion and for format change-BeforeFormat and AfterFormat.
When we are using Revisions to get all the track changes, giving wrong count as word document is showing.
(Ex: 11 changes-Both Insertion and Deletion) , but from aspose api showing 16 count(which it is breaking into different lines)
If i use RevisionGroup, i am getting the results which is similar to results in Ms-Office viewer.
But the challenge here is I am not able to get the beforetext and aftertext values for each insertion/deletion/format_change entries.

If i use Revision, i am able to get the data and I can get nextsibling to get the aftertext value, but it is generating more results(16 revisions) from the expected results(11 revisions) and also due to the more count values are splitting and nextsibling is showing as wrong.
Ex: 1984 changed to 2,084
[0]: 198
[1]: 4
[2]: ""
[3]: 2
[4]: ,084

Please provide good soultion to read all track changes(Insertion, Deletion, Format_change) values
with Date, Author Name, BeforeText, AfterText and Revision Type from word documents with correct count for Insertion and Deletion.
Ex: 1984 changed to 2,084
BeforeText: 1984
AfterText: 2,084Sample.zip (13.4 KB)

Please find the attached(sample.zip) sample docx attached.

@sureshkap In your case you should process both Revision and RevisionGroup. For example see the following code:

Document doc = new Document(@"C:\Temp\in.docx");

Dictionary<RevisionGroup, List<Revision>> groups = new Dictionary<RevisionGroup, List<Revision>>();
List<Revision> individualRevisions = new List<Revision>();

foreach (Revision rev in doc.Revisions)
    if (rev.Group == null)

    if (!groups.ContainsKey(rev.Group))
        groups.Add(rev.Group, new List<Revision>());


Console.WriteLine("There are {0} revision groups in the document.", groups.Count);
Console.WriteLine("There are {0} individual revisions in the document.", individualRevisions.Count);
foreach (RevisionGroup g in groups.Keys)
    Console.WriteLine("Revision group type : {0}", g.RevisionType);
    Console.WriteLine("Revision group author : {0}", g.Author);
    Console.WriteLine("Revision group modified text : \"{0}\"", g.Text);

    // Print an individual revision information within a group.
    foreach (Revision r in groups[g])

// Print an individual revisions
if (individualRevisions.Count > 0)
    Console.WriteLine("Individual revisions.");
    foreach (Revision r in individualRevisions)
private static void PrintRevisionInfo(Revision r)
    Console.WriteLine("\tDate: {0}", r.DateTime);
    Console.WriteLine("\tAuthor: {0}", r.Author);
    Console.WriteLine("\tRevisionType: {0}", r.RevisionType);
    Console.WriteLine("\tRevision is applied to text: \"{0}\"", r.ParentNode.ToString(SaveFormat.Text));