Comments are Lost after Modifying the Document with MS Word | Compare Documents using Java

I have two documents, docA and docB. docA has a comment and docB is the same as docA with suggested change but no comment. I open both documents and call docA.compare(docB) and save the result to docC. docC looks ok when opened, including the change and original comment. But if I make any changes to docC and save it, the original comment become empty.
Attached are the sample word files and the java class.compare.zip (30.6 KB)

Not sure if it is the same problem, but sounds similar: Comments do not survive two consecutive Document.compare calls - #6 by awais.hafeez

@yilin

You are using following CompareOptions in your code.

com.aspose.words.CompareOptions options = new com.aspose.words.CompareOptions();
options.setIgnoreComments(true);

We have tested the scenario and noticed that the comments are not ignored in output document. There is no comment in output document. However, when document is modified via MS Word. The output document has empty comment.

We have logged this problem in our issue tracking system as WORDSNET-22562. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thank you for the quick response. We DO want to keep the comments, so I just tried options.setIgnoreComments(false); and still got the same result as you described: the original comments show up correctly in the output document, but once the document is modified in MS word, the comments becomes empty. Output document generated via Compare menu in MS word doesn’t have this problem.

@yilin

Thanks for sharing the detail. After further investigation, we noticed that MS Word and Aspose.Words output is not same. We have logged separate issue for it as WORDSNET-22563. When we use IgnoreComments = true, the comment is not ignored. The issue ID for this issue is WORDSNET-22562.

We will inform you via this forum thread once your issues are resolved.

@yilin

Regarding WORDSNET-22562, please upgrade to the latest version of Aspose.Words for Java 21.9 to avoid this issue. We have closed this issue as ‘Not a Bug’.

Please note that you do not need to use CompareOptions.IgnoreComments property. By default, Aspose.Words does not mark the comments for insertion/deletion and MS Word does the same.

The issues you have found earlier (filed as WORDSNET-22562) have been fixed in this Aspose.Words for Java 22.1 update.

@yilin Comment comparison has been improved recently. Could you please try the latest 22.7 version of Aspose.Words for Java and let us know whether the result is acceptable for you.

The issues you have found earlier (filed as WORDSNET-22563) have been fixed in this Aspose.Words for Java 22.11 update also available on Maven.