Compare multiple documents protected by password

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 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

using GroupDocs.Comparison;
using GroupDocs.Comparison.Options;
// ...

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

Compare several password-protected documents from stream

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

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