The result is a regular document of the compared format, so you can open it with any library that supports the format. The example below opens a Word result with Aspose.Words for Java and appends some text to it. Aspose.Words for Java is a separate product — add it to your project as its own dependency.
importcom.groupdocs.comparison.Comparer;importcom.aspose.words.Document;importcom.aspose.words.DocumentBuilder;importjava.nio.file.Path;// ...
try(Comparercomparer=newComparer("source.docx")){// Add target document and save comparison result
comparer.add("target.docx");finalPathresultPath=comparer.compare("result.docx");// Open the result document with Aspose.Words
DocumentasposeDocument=newDocument(resultPath.toString());// Access the Document's builder to add content.
DocumentBuilderbuilder=newDocumentBuilder(asposeDocument);// Add some text to the document.
builder.writeln("Hello, World!");builder.write("This is an example of using Aspose.Words.");// Save the document to a file.
asposeDocument.save("output.docx");}