Compare multiple documents
NoteThis feature is available only for Word documents, PowerPoint and Open Document presentations.
GroupDocs.Comparison allows you to compare more that two documents.
To compare several documents, follow these steps:
- Instantiate the Comparer object. Specify the source document path or stream.
- Call the add() method and specify target document path or stream. Repeat this step for every target document.
- Call the compare() method.
The following code snippets show how to several documents:
try (Comparer comparer = new Comparer(sourceFile)) {
comparer.add(targetFile1);
comparer.add(targetFile2);
comparer.add(targetFile3);
final Path resultPath = comparer.compare(resultInputStream);
}
The result is as follows:
try (Comparer comparer = new Comparer(sourceInputStream)) {
comparer.add(targetInputStream1);
comparer.add(targetInputStream2);
comparer.add(targetInputStream3);
final Path resultPath = comparer.compare(resultInputStream);
}