Compare multiple documents

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Comparison MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-comparison -- dnx GroupDocs.Comparison.Mcp --yes
Folders, licensing and more →
Note
This feature is available only for Word documents, PowerPoint and Open Document presentations.

GroupDocs.Comparison allows you to compare more than 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 compare several documents:

Compare several documents from a local disk

using GroupDocs.Comparison;
// ...

using (Comparer comparer = new Comparer("source.docx"))
{
    comparer.Add("target1.docx");
    comparer.Add("target2.docx");
    comparer.Add("target3.docx");
    comparer.Compare("result.docx");
}

The result is as follows:

Compare several documents from a stream

using GroupDocs.Comparison;
using System.IO;
// ...

using (Comparer comparer = new Comparer(File.OpenRead("source.docx")))
{
	comparer.Add(File.OpenRead("target1.docx"));
    comparer.Add(File.OpenRead("target2.docx"));
    comparer.Add(File.OpenRead("target3.docx"));
    comparer.Compare(File.Create("result.docx"));
}

See also