HtmlLoadOptions Constructor (String)

A shortcut to initialize a new instance of this class with the specified password to load an encrypted document.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public HtmlLoadOptions(
	string password
)

Parameters

password
Type: SystemString
The password to open an encrypted document. Can be null or empty string.
Examples
Shows how to encrypt an Html document and then open it using a password.
// 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());
See Also