HtmlLoadOptions Constructor (String) |
Namespace: Aspose.Words
// Create and sign an encrypted html document from an encrypted .docx CertificateHolder certificateHolder = CertificateHolder.Create(MyDir + "morzal.pfx", "aw"); SignOptions signOptions = new SignOptions { Comments = "Comment", SignTime = DateTime.Now, DecryptionPassword = "docPassword" }; string inputFileName = MyDir + "Encrypted.docx"; string outputFileName = ArtifactsDir + "HtmlLoadOptions.EncryptedHtml.html"; DigitalSignatureUtil.Sign(inputFileName, outputFileName, certificateHolder, signOptions); // This .html document will need a password to be decrypted, opened and have its contents accessed // The password is specified by HtmlLoadOptions.Password HtmlLoadOptions loadOptions = new HtmlLoadOptions("docPassword"); Assert.AreEqual(signOptions.DecryptionPassword, loadOptions.Password); Document doc = new Document(outputFileName, loadOptions); Assert.AreEqual("Test encrypted document.", doc.GetText().Trim());