Multi-target comparison is supported for Microsoft Word documents, Microsoft PowerPoint presentations, and OpenDocument presentations.
GroupDocs.Comparison can compare a source document against more than two targets in a single operation. Call add() for every target before calling compare().
Steps to compare multiple documents
Instantiate a Comparer with the source document path or stream.
Call add() for each target document. Repeat for every target.
Call compare() and specify the result file path or output stream.
Example 1: Compare several documents from file paths
fromgroupdocs.comparisonimportComparerdefcompare_multiple_documents():withComparer("./source.docx")ascomparer:comparer.add("./target1.docx")comparer.add("./target2.docx")comparer.add("./target3.docx")comparer.compare("./result.docx")print("Documents compared successfully. Result saved to result.docx.")if__name__=="__main__":compare_multiple_documents()
source.docx is the source file used in this example. Click here to download it.
target1.docx is a target file used in this example. Click here to download it.
target2.docx is a target file used in this example. Click here to download it.
target3.docx is a target file used in this example. Click here to download it.
Example 4: Compare multiple password-protected documents
When the source or target documents are password-protected, supply the password through a LoadOptions object when constructing the Comparer and when calling add().