Compare multiple documents protected by password
NOTE: This feature is available only for Word documents, PowerPoint and Open Document presentations.
GroupDocs.Comparison allows to compare more that 2 documents (also documents that are protected with a password).
The following are the steps to compare password-protected documents.
- Instantiate LoadOptions object and specify source document password;
- Instantiate Comparer object with source document path or stream and LoadOptions object created at previous step;
- Instantiate another LoadOptions object and specify target document password;
- Call Add method and specify target document path or stream and LoadOptions object created at previous step. Repeat this step for every target document that is password-protected;
- Call Compare method.
The following code sample shows how to compare password-protected documents.
Compare multiple documents from local disk
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 multiple protected documents from stream
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"));
}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Comparison for .NET examples, plugins, and showcase
- GroupDocs.Comparison for Java examples, plugins, and showcase
- Document Comparison for .NET MVC UI Example
- Document Comparison for .NET App WebForms UI Modern Example
- Document Comparison for Java App Dropwizard UI Modern Example
- Document Comparison for Java Spring UI Example
Free Online App
Along with full-featured .NET library we provide simple, but powerful free Apps.
You are welcome to compare your DOC or DOCX, XLS or XLSX, PPT or PPTX, PDF, EML, EMLX, MSG and other documents with free to use online GroupDocs Comparison App.