Compare Two Word Documents by using Aspose.Words for C++ 19.6

Share on FacebookTweet about this on TwitterShare on LinkedIn

In this post, we will see how to Compare two Word Documents by using Aspose.Words for C++ 19.6 API.

You can use Document.Compare method to compare two Word documents to see the difference between them. This method mimics Microsoft Word’s Compare feature and produces document difference as a number of edit and format revisions. The main idea is that if we reject all revisions then we get a document which is equal to the original document. On the contrary, if we accept all revisions then we get the final (comparison target) document.

Limitations

There are a few general limitations:

  • The document being compared must not have revisions before this method is called.
  • Markup – is limited to SmartTag only. Other markups are ignored completely.
  • DML- Fallback shapes are compared instead of actual DML comparison.

There is an important note regarding “equal”. Actually “equality” means here that the comparison method is not able to represent changes as revisions. In general, it means that both document text and text formatting are the same. But there can be other difference between documents. For example, Word supports only format revisions for styles and we can’t represent style insertion/deletion. So documents can have a different set of styles and the Compare method still produces no revisions.

Following example shows normal comparison case.

Below example shows how to test that Word Documents are “Equal”.

See Also Useful Links

The resources, you may need to accomplish your tasks:

Keeping the Aspose tradition, you are welcome to shape the upcoming releases of Aspose.Words for C++ API by posting your suggestions and concerns in the Aspose.Words for C++ support forum.

The post Compare Two Word Documents by using Aspose.Words for C++ 19.6 appeared first on File Format APIs Blog – aspose.com.