Starting with Aspose.Words 24.10, comparing files at the word level may incorrectly mark too much text as inserted and deleted.
Attached is an example, with the original file, the revised file, a code sample and the compare output generated with version 24.9 (showing a correct compare) and with version 24.10 (showing the incorrect compare).
Compare_V24_10_bug.zip (28.8 KB)
It appears you are encountering an issue with Aspose.Words version 24.10, where the document comparison is incorrectly marking excessive text as inserted or deleted. This may be a bug introduced in that version.
To resolve this, you could revert to version 24.9, which you noted produces accurate comparison results. Additionally, you can adjust the CompareOptions
settings to refine the comparison. For instance, you can ignore specific elements such as formatting, comments, or headers and footers, which may help reduce discrepancies.
Here’s a sample code snippet to configure the comparison options:
using Aspose.Words;
using Aspose.Words.Comparing;
// Load documents
Document docA = new Document("path/to/original.docx");
Document docB = new Document("path/to/revised.docx");
// Set up compare options
CompareOptions options = new CompareOptions
{
IgnoreFormatting = true,
IgnoreHeadersAndFooters = true,
IgnoreComments = true,
IgnoreTables = true,
IgnoreFields = true,
IgnoreFootnotes = true,
IgnoreTextboxes = true
};
// Compare documents
docA.Compare(docB, "user", DateTime.Now, options);
// Check results
Console.WriteLine(docA.Revisions.Count == 0 ? "Documents are equal" : "Documents are not equal");
If the issue persists after trying these adjustments, consider reporting it to Aspose support along with your example files and code for further assistance.
The compare options in the code example are mandatory for us. For example, we know that this issue does not occur when comparing at the character level. We need a comparison at the word level. Also, given that many other compare issues have been addressed in 24.10, we do not want to stick to 24.9 and need to move forward with more recent versions of Aspose.Words.
@andrelafond
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-28651
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.