We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Word-Document-Compare: how to retrieve details of the formatting changes and transform them


we are using Aspose-Word-Java-API and this issue is similar to an older request:

<a rel=“nofollow” href="https://forum.aspose.com/t/41876

We want to figure out a “compare-document” that is provided by Document.compare(…).
in a special way as follows:

The compare document provides “meta-information” by using highlight-colors and strike-throughs to display what has changed, what has been added and what has been deleted,
an by what author when comparing the source and the target document.

The comparsion-view can be configured in MsWord itsself as you know.

My interest is to get those meta-informations via your Java-MsWord-API!

Our goal here is to parse those informations and transform them into a simple word document
with “real” text-highlighting, strike- throughs, etc. according to the design guide of our company.

We use these “simplified” compare word documents to provide a simple overview of changes made for our stakeholders, contractors and others.

Our stakeholders insist on a simplified (compare-) document different from the way MsWord
displays them in its default compare document.

As an example:

If a run of text (Class Run) is “displayed” for instance red in the MsWord-default-compare-document, denoting that it has been added, we want to really add it (!) and then set its “real highlight” color to red or some other color and then finally removing (!) the meta-information (namely that it has bee added).

This is somehow similar to the feature “accept change” provided by word.

The WordProcessing MarkUpLanguage (WordML) and related frameworks like docx4j might be an alternative if your API isn’t able?

Regards an greetings!


Hi Mikel,

Thanks for your inquiry. The text formatting e.g. text-highlighting, strike- through, etc. after document comparison is not stored in document. It is MS Word (Application) level setting therefore cannot be controlled by Aspose.Words.

However, you can get a collection of revisions (tracked changes) that exist in the document using Document.Revisions property. Please use the Revision.ParentNode property to get the immediate parent node (owner) of this revision and insert it into new document according to your requirements. You can set the formatting of newly added Paragraph and Run nodes using Aspose.Words. Please refer to the following articles:

Use DocumentBuilder to Insert Document Elements
Specifying Formatting

If you still face problem, please share your input and expected output documents here for our reference. We will then provide you more information about your query.