Docx comparison shows text as removed instead of added

Hi, It appears as if we stumbled upon an issue when comparing two docx-documents. Find them attached in this topic.

To explain the issue, notice that the first document does not contain the word “GEMA” but the second document does. Still, the comparison shows that “GEMA” was removed (marked as red) instead of added (green). This appears to be a bug?

As of when writing this, It works to reproduce the issue in the online comparison tool:
Compare DOCX Online | Free GroupDocs Apps

Original document:
CANEA TEST 1.0.docx (14.0 KB)
image.png (11.5 KB)

Changed document:
CANEA TEST 2.0.docx (14.0 KB)
image.png (14.2 KB)

Comparison:
comparison.jpeg (53.6 KB)

We are however using GroupDocs.Comparison version 25.6.0 for target framework .net48

@lars.olsson

Why “GEMA” is shown as removed

In GroupDocs.Comparison the first file you pass to the Compare method is treated as the source (the “original” document).
All text that exists only in this source is marked removed (red), while text that exists only in the second file (the target) is marked added (green).

In the screenshots you posted the document containing the word “GEMA” was supplied as the first argument, therefore the engine thinks that the word was present in the original version and then disappeared – consequently it is displayed as a deletion.

Quick fix

Pass the documents in the correct order:

// 1️⃣  Load the original document (without “GEMA”)
var original = new ComparisonDocument("CANEA TEST 1.0.docx");

// 2️⃣  Load the changed document (with “GEMA”)
var revised  = new ComparisonDocument("CANEA TEST 2.0.docx");

// 3️⃣  Compare – original first, revised second
var comparer = new Comparer(original, revised);
var result   = comparer.Compare();

// Save the result
result.Save("ComparisonResult.docx");

Now “GEMA” will appear in green (added) as you expect.


Additional tips for reliable results

Setting What it does When to use it
ComparisonSettings.IgnoreFormatting = true Ignores pure formatting changes (e.g., font size) If you only care about textual content
ComparisonSettings.EnableMoveDetection = true Detects moved paragraphs/words instead of treating them as a delete + insert For long documents with reordered sections
ComparisonSettings.InsertedItemColor / DeletedItemColor Customise the highlight colours To match your corporate style

Example with custom settings

var settings = new ComparisonSettings
{
    IgnoreFormatting = true,
    EnableMoveDetection = true,
    InsertedItemColor = System.Drawing.Color.LightGreen,
    DeletedItemColor   = System.Drawing.Color.LightCoral
};

var comparer = new Comparer(original, revised, settings);
var result   = comparer.Compare();
result.Save("StyledComparison.docx");

If you still see the issue

  1. Verify the order of the two ComparisonDocument objects.
  2. Upgrade to the latest GroupDocs.Comparison release (newer versions contain bug‑fixes and improved diff algorithms).
  3. Provide a minimal reproducible code snippet (the two Compare calls) so we can reproduce the problem in our test environment.

Helpful links

If you have any further questions or need assistance integrating the correct document order into your workflow, feel free to let us know!

The assumption that we are supplying the document containing the word “GEMA” as the first argument is not correct in our case. To dig into the underlying issue we would benefit from further assistance. Thank you!

@lars.olsson

We are investigating this issue. Your investigation ticket ID is COMPARISONNET-4542.