LoadOptions Constructor (LoadFormat, String, String)

A shortcut to initialize a new instance of this class with properties set to the specified values.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public LoadOptions(
	LoadFormat loadFormat,
	string password,
	string baseUri
)

Parameters

loadFormat
Type: Aspose.WordsLoadFormat
The format of the document to be loaded.
password
Type: SystemString
The password to open an encrypted document. Can be null or empty string.
baseUri
Type: SystemString
The string that will be used to resolve relative URIs to absolute. Can be null or empty string.
Examples
Shows how to insert the HTML contents from a web page into a new document.
// The url of the page to load 
const string url = "http://www.aspose.com/";

// Create a WebClient object to easily extract the HTML from the page
WebClient client = new WebClient();
string pageSource = client.DownloadString(url);
client.Dispose();

// Get the HTML as bytes for loading into a stream
Encoding encoding = client.Encoding;
byte[] pageBytes = encoding.GetBytes(pageSource);

// Load the HTML into a stream.
using (MemoryStream stream = new MemoryStream(pageBytes))
{
    // The baseUri property should be set to ensure any relative img paths are retrieved correctly
    LoadOptions options = new LoadOptions(Aspose.Words.LoadFormat.Html, "", url);

    // Load the HTML document from stream and pass the LoadOptions object
    Document doc = new Document(stream, options);

    // Save the document to disk
    // The extension of the filename can be changed to save the document into other formats. e.g PDF, DOCX, ODT, RTF.
    doc.Save(ArtifactsDir + "Document.InsertHtmlFromWebPage.doc");
}
See Also