Hello Team,
I am facing a problem during the Aspose Words document comparison.
Issue:
After document comparison, I obtain the expected result; however, I cannot observe any track changes in the compared file. Currently, I am using the Aspose 18.5 Java version.
I also tried Compare two DOCX files using Aspose Words Java this is giving me expected output for my documents.
Document firstDoc = new Document(firstFile.getAbsolutePath());
Document secondDoc = new Document(clientNewFile.getAbsolutePath());
if(firstDoc.hasRevisions()){
firstDoc.acceptAllRevisions();
}
if (secondDoc.hasRevisions()){
secondDoc.acceptAllRevisions();
}
firstDoc.getChildNodes(NodeType.COMMENT, true).clear();
secondDoc.getChildNodes(NodeType.COMMENT, true).clear();
CompareOptions options = new CompareOptions();
options.setIgnoreFormatting(true);
options.setIgnoreHeadersAndFooters(true);
options.setTarget(ComparisonTargetType.CURRENT);
secondDoc.compare(firstDoc, "Compare", new Date(), options);
File comparedFileDirectory = new File("uploads", UUID.randomUUID().toString());
comparedFileDirectory.mkdirs();
File comparedFile = new File(comparedFileDirectory, Objects.requireNonNull("output.docx"));
secondDoc.save(comparedFile.getAbsolutePath(), SaveFormat.DOCX);
Here is the expected output, that I’m expecting.
Could you kindly provide the reason for these issues and suggest any possible solutions, if available?
documents.zip (17.4 KB)