HtmlLoadOptions 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 HtmlLoadOptions(
	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 specify a base URI when opening an html document.
// If we want to load an .html document which contains an image linked by a relative URI
// while the image is in a different location, we will need to resolve the relative URI into an absolute one
// by creating an HtmlLoadOptions and providing a base URI 
HtmlLoadOptions loadOptions = new HtmlLoadOptions(LoadFormat.Html, "", ImageDir);
Document doc = new Document(MyDir + "Missing image.html", loadOptions);

// While the image was broken in the input .html, it was successfully found in our base URI
Shape imageShape = (Shape)doc.GetChildNodes(NodeType.Shape, true)[0];
Assert.True(imageShape.IsImage);

// The image will be displayed correctly by the output document
doc.Save(ArtifactsDir + "HtmlLoadOptions.BaseUri.docx");
See Also