Compare multiple documents protected by password

Note
This feature is available only for Word documents, PowerPoint, and Open Document presentations.

GroupDocs.Comparison allows you to compare more that two password-protected documents.

To compare several password-protected documents, follow these steps:

  1. Instantiate the LoadOptions object. Specify source document password.
  2. Instantiate the Comparer object. Specify the source document path or stream and the LoadOptions object created in the previous step.
  3. Instantiate another LoadOptions object and specify target document password.
  4. Call the add() method and specify the target document path or stream and the LoadOptions object created at previous step. Repeat steps 3-4 for every target document.
  5. Call the compare() method.

The following code snippets shows how to compare several password-protected documents:

Compare several password-protected documents from local disk

import com.groupdocs.comparison.Comparer;
import com.groupdocs.comparison.words.revision.*;
import java.awt.*;
import java.nio.file.Path;
// ...

try (Comparer comparer = new Comparer("source.docx", new LoadOptions("source-password"))) {
    comparer.add("target.docx", new LoadOptions("target-password"));
    comparer.add("target2.docx", new LoadOptions("target-password"));
    comparer.add("target3.docx", new LoadOptions("target-password"));
    final Path resultPath = comparer.compare("result.docx");
}

Compare several password-protected documents from stream

import com.groupdocs.comparison.Comparer;
import com.groupdocs.comparison.words.revision.*;
import java.awt.*;
import java.nio.file.Path;
import java.io.FileInputStream;
import java.io.InputStream;
// ...

try (Comparer comparer = new Comparer(sourceInputStream, new LoadOptions("source-password"))) {
    comparer.add(targetInputStream1, new LoadOptions("target-password"));
    comparer.add(targetInputStream2, new LoadOptions("target-password"));
    comparer.add(targetInputStream3, new LoadOptions("target-password"));
    final Path resultPath = comparer.compare(resultInputStream);
}