Sometimes when working with documents you may need to get the result of a comparison of files in which one or even both files are password protected, and for this very case there is an option to compare files in spite of the fact that they are protected. This option allows you to compare protected files in any format where it is possible to set a password for the file.
The code sample to compare two password-protected files:
stringsourcePath=@"source.format";// NOTE: Path to the source documentstringtargetPath=@"target.format";// NOTE: Path to the target documentstringresultPath=@"result.format";// NOTE: Path to the result documentOptions.LoadOptionsloadOptionsSource=newOptions.LoadOptions{Password="passwordSource"};// NOTE: options with password for the first fileOptions.LoadOptionsloadOptionsTarget=newOptions.LoadOptions{Password="passwordTarget"};// NOTE: options with password for the second fileusing(Comparercomparer=newComparer(sourcePath,loadOptionsSource)){comparer.Add(targetPath,loadOptionsTarget);CompareOptionscompareOptions=newCompareOptions{DetectStyleChanges=true,DetalisationLevel=DetalisationLevel.High};comparer.Compare(resultPath,compareOptions);}
As a result, we get the resulting comparison file of two password-protected files.
More resources
Advanced Usage Topics
To learn more about document comparison features, please refer to the advanced usage section.
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
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.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.