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?
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
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!