Compare multiple documents with specific compare settings

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

GroupDocs.Comparison allows you to compare more than two documents and specify specific comparison options like styling for detected changes, comparison sensitivity level, etc.

To compare multiple documents using the specific options, follow these steps:

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

The following code snippets show how to compare multiple documents with the appropriate options:

Compare multiple documents with specific compare settings from a local disk

const comparer = new groupdocs.comparison.Comparer(sourceFile);
comparer.add(targetFile1);
comparer.add(targetFile2);
comparer.add(targetFile3);

const styleSettings = new groupdocs.comparison.StyleSettings();
styleSettings.setFontColor(Color.YELLOW);

const compareOptions = new groupdocs.comparison.CompareOptions();
compareOptions.setInsertedItemStyle(styleSettings);

const resultPath = comparer.compare(resultFile, compareOptions);

The result is as follows:

Compare multiple documents with specific compare settings from a stream

const comparer = new groupdocs.comparison.Comparer(sourceInputStream);
comparer.add(targetInputStream1);
comparer.add(targetInputStream2);
comparer.add(targetInputStream3);

const styleSettings = new groupdocs.comparison.StyleSettings();
styleSettings.setFontColor(Color.YELLOW);

const compareOptions = new groupdocs.comparison.CompareOptions();
compareOptions.setInsertedItemStyle(styleSettings);

const resultPath = comparer.compare(resultInputStream, compareOptions);