Compare multiple documents

Note
This 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:

  1. Instantiate the Comparer object. Specify the source document path or stream.
  2. Call the add() method and specify target document path or stream. Repeat this step for every target document.
  3. Call the compare() method.

The following code snippets show how to several documents:

Compare several documents from a local disk

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:

Compare several documents from a stream

try (Comparer comparer = new Comparer(sourceInputStream)) {
    comparer.add(targetInputStream1);
    comparer.add(targetInputStream2);
    comparer.add(targetInputStream3);
    final Path resultPath = comparer.compare(resultInputStream);
}