Set password for output document
Leave feedback
On this page
GroupDocs.Comparison allows you to protect output document with password.
To protect output document, follow these steps:
- Instantiate the Comparer object. Specify the source document path or stream.
- Call the Add method. Specify the target document path or stream.
- Instantiate the CompareOptions object. Set the PasswordSaveOption to
PasswordSaveOption.User
. - Instantiate the SaveOptions object. Use the Password property to specify a password string.
- Call the Compare method. Specify the SaveOptions and CompareOptions objects as parameters.
The following code snippet shows how to compare documents and protect the output document with password:
using GroupDocs.Comparison;
using GroupDocs.Comparison.Options;
// ...
using (Comparer comparer = new Comparer("source.docx"))
{
comparer.Add("target.docx");
CompareOptions cOptions = new CompareOptions
{
PasswordSaveOption = PasswordSaveOption.User
};
SaveOptions sOptions = new SaveOptions()
{
Password = "3333"
};
comparer.Compare("result.docx", sOptions, cOptions);
}
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.