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 than two password-protected documents.

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

  1. Instantiate the LoadOptions object. Specify the password for the source document.
  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 the password for the target document.
  4. Call the add() method and specify the target document path or stream and the LoadOptions object created in step 3. Repeat steps 3 and 4 for every target document.
  5. Call the compare() method.

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

Compare several password-protected documents from a local disk

const comparer = new groupdocs.comparison.Comparer(sourceFile, new groupdocs.comparison.LoadOptions("source-password"));
comparer.add(targetFile1, new groupdocs.comparison.LoadOptions("target-password"));
comparer.add(targetFile2, new groupdocs.comparison.LoadOptions("target-password"));
comparer.add(targetFile3, new groupdocs.comparison.LoadOptions("target-password"));
const resultPath = comparer.compare(resultFile);

Compare several password-protected documents from a stream

const comparer = new groupdocs.comparison.Comparer(sourceInputStream, new groupdocs.comparison.LoadOptions("source-password"));
comparer.add(targetInputStream1, new groupdocs.comparison.LoadOptions("target-password"));
comparer.add(targetInputStream2, new groupdocs.comparison.LoadOptions("target-password"));
comparer.add(targetInputStream3, new groupdocs.comparison.LoadOptions("target-password"));
const resultPath = comparer.compare(resultInputStream);