Document document = new Document(); Document insertThis = new Document("insertthis.docx"); Document expected = new Document("expected.docx"); DocumentBuilder builder = new DocumentBuilder(document); builder.insertDocument(insertThis, ImportFormatMode.KEEP_DIFFERENT_STYLES); document.save("asposetest/output.docx"); document.compare(expected, "test user", new Date()); document.save("output_withrevisions.docx");
The scenario is as follows. We are comparing a document with a different document that is created on the fly. The created document has another document inserted into it with builder.insertDocument(). The inserted document has an image inside of it. Comparing the first document with the created document now shows them as being unequal because of the image, even though the images are exactly the same. See the attached zip-file for an example.
documents.zip (1.5 MB)