Free Support Forum - aspose.app

Document compare docx files with merge fields

Hi,

Using com.aspose:aspose-words:17.12:jdk16
When Document.compare with .docx files having merge fields, the format with merge field gets messed up. Difference is displayed at the end of the paragraph, instead where the location is.

// Create com.aspose.words.Document with “InputStream”
com.aspose.words.Document asposeOrig = new com.aspose.words.Document(is);
com.aspose.words.Document asposeCurrent = new com.aspose.words.Document(is2);

final CompareOptions compareOptions = new CompareOptions();
compareOptions.setIgnoreFormatting(true);
asposeOrig.compare(asposeCurrent, “System”, new Date(), compareOptions);

final PdfSaveOptions opts = new PdfSaveOptions();
opts.setMemoryOptimization(true);

//Save compare document to “OutputStream”
asposeOrig.save(out, opts);

  1. Tried by updating to free latest version of apose to 20.9 from 17.12, to get several ignore formatting options like
    compareOptions.setIgnoreFormatting(true);
    compareOptions.setIgnoreFields(true);
    compareOptions.setTarget(ComparisonTargetType.NEW)
  2. Tried to save these documents locally in various types of document, seems that the issue is in “compare” API, it is messing up the format of the merge fields.
    All the mentioned files are displaying the exactly same result.
  • asposeOrig.save(“C:\apose\testing.doc”, opts1);
  • asposeOrig.save(“C:\apose\testing.pdf”, opts);
  • asposeOrig.save(“C:\apose\testing.html”, opts3);

This topic has been moved to the related forum: https://forum.aspose.com/t/document-compare-docx-files-with-merge-fields/219731