Table of contents displays incorrect section numbering and loses color coded changes when comparing DOCX files

Hello,

We are having an issue with GroupDocs.Comparison for .NET that causes the comparison of two difference versions of an MS Word document to not display correctly.

In the specific scenario we are comparing these documents:
previous-version.docx (89.7 KB)
current-version.docx (88.2 KB)

The first problem is that the table of content section will not display color coded changes. Furthermore, the table numbering is modified, incorrectly placing one of the changes in a new section 2.2 that is not supposed to exist.

See below screenshots of the table of contents:

Old version:
image.png (30.9 KB)

New version:
image.png (29.5 KB)

Comparison:
image.png (36.6 KB)

The remaining content following the table of contents will display color coded changes, however, the structure of the document will be incorrect due to the inadvertent addition of section 2.2, making the comparison messy and not so helpful.

The results occur for GroupDocs.Comparison v. 26.2.0 when running on console applications (we have tested both .NET 10 and .NET Framework 4.8 with identical results), on Windows 11, like so:

using var comparer = new Comparer(loadPath1);
comparer.Add(loadPath2);
comparer.Compare(outputPath);

When attempting to compare the same documents with your online comparison tool at Document Comparison APIs & Apps we cannot get it to work but are instead stuck on an empty gray screen.

Thank you for your assistance.

Hi @lars.olsson!

Thank you for your request!
We are investigating the issue and will get back to you with the update early next week.

hi @lars.olsson ,
Thank you for your detailed message and for providing the sample documents.
We were able to reproduce the issue on our side. Our team is currently investigating it, and we will let you know once a fix is available.

In the meantime, we would suggest trying an alternative way to display comparison results in Word—using tracked revisions instead of highlighted changes. This approach uses a slightly different internal mechanism and works better in scenarios like yours, especially when the document contains field codes (such as a table of contents).

Here is a sample code snippet:

using (Comparer comparer = new Comparer(source))
{
    comparer.Add(target);
    var options = new WordCompareOptions()
    {
        DisplayMode = WordCompareOptions.ComparisonDisplayMode.Revisions,
        RevisionAuthorName = "GroupDocs"
    };

    comparer.Compare(outFilePath, options);
}

Please let us know if this approach works for you, and feel free to reach out if you have any further questions.