The task to compare text files is very common when incorporating changes into a unified document. Therefore during the review and merge process, the text compare operation is performed and we often use utilities to compare text online. So in this article, we are going to discuss the steps on how to compare word documents and compare text files using Java SDK.
Aspose.Words Cloud SDK for Java provides a huge array of features enabling you can create, edit and manipulate Word documents within Java application. Now in order to use the SDK, please add the following details to the pom.xml of the maven build project.
Once the SDK is installed, please register a free account over Aspose.Cloud dashboard using GitHub or Google account or simply Sign Up and obtain your Client Credentials.
Compare Word Documents in Java
In this section, we are going to discuss the details of how to compare word documents using Java code snippets.
The first step is to create an instance of WordsApi using client credentials
Secondly, upload the input and modified Word documents to cloud storage while passing the UploadFileRequest object to uploadFile(…) method of WordsApi
Thirdly, create a CompareData object and pass the second document as an argument to the setComparingWithDocument(…) method
Now create an object of CompareDocumentRequest class where we pass input Word file, CompareData object, and resultant word document as arguments
Finally, compare text files using compareDocument(…)method and save the output in cloud storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We can also access Aspose.Words Cloud via cURL commands and compare text files. So as a pre-requisite, please execute the following command to create a JWT access token based on Client ID and Client Secret details.
This article has explained the steps to compare documents using Java as well as cURL commands. You may consider exploring the API capabilities through the swagger interface. Furthermore, the complete source code of SDK can be downloaded from GitHub. In case you have any further queries or you face any difficulty, please visit the free support forum.
Related Articles
We highly recommend going through the following blogs