Class HtmlLoadOptions

Class HtmlLoadOptions

Namespace: Aspose.Words.Loading
Assembly: Aspose.Words.dll (25.3.0)

Allows to specify additional options when loading HTML document into a Aspose.Words.Document object.

To learn more, visit the Specify Load Options documentation article.

public class HtmlLoadOptions : LoadOptions

Inheritance

objectLoadOptionsHtmlLoadOptions

Inherited Members

LoadOptions.Equals(object), LoadOptions.LoadFormat, LoadOptions.Password, LoadOptions.BaseUri, LoadOptions.Encoding, LoadOptions.ResourceLoadingCallback, LoadOptions.WarningCallback, LoadOptions.ProgressCallback, LoadOptions.PreserveIncludePictureField, LoadOptions.ConvertShapeToOfficeMath, LoadOptions.FontSettings, LoadOptions.TempFolder, LoadOptions.ConvertMetafilesToPng, LoadOptions.MswVersion, LoadOptions.UpdateDirtyFields, LoadOptions.IgnoreOleData, LoadOptions.UseSystemLcid, LoadOptions.LanguagePreferences, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

HtmlLoadOptions()

Initializes a new instance of this class with default values.

public HtmlLoadOptions()

HtmlLoadOptions(string)

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

public HtmlLoadOptions(string password)

Parameters

password string

The password to open an encrypted document. Can be null or empty string.

HtmlLoadOptions(LoadFormat, string, string)

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

public HtmlLoadOptions(LoadFormat loadFormat, string password, string baseUri)

Parameters

loadFormat LoadFormat

The format of the document to be loaded.

password string

The password to open an encrypted document. Can be null or empty string.

baseUri string

The string that will be used to resolve relative URIs to absolute. Can be null or empty string.

Properties

BlockImportMode

Gets or sets a value that specifies how properties of block-level elements are imported. Default value is Aspose.Words.Loading.BlockImportMode.Merge.

public BlockImportMode BlockImportMode { get; set; }

Property Value

BlockImportMode

ConvertSvgToEmf

Gets or sets a value indicating whether to convert loaded SVG images to the EMF format. Default value is false and, if possible, loaded SVG images are stored as is without conversion.

public bool ConvertSvgToEmf { get; set; }

Property Value

bool

Remarks

Newer versions of MS Word support SVG images natively. If the MS Word version specified in load options supports SVG, Aspose.Words will store SVG images as is without conversion. If SVG is not supported, loaded SVG images will be converted to the EMF format.

If, however, this option is set to true, Aspose.Words will convert loaded SVG images to EMF even if SVG images are supported by the specified version of MS Word.

IgnoreNoscriptElements

Gets or sets a value indicating whether to ignore <noscript> HTML elements. Default value is false.

public bool IgnoreNoscriptElements { get; set; }

Property Value

bool

Remarks

Like MS Word, Aspose.Words does not support scripts and by default loads content of <noscript> elements into the resulting document. In most browsers, however, scripts are supported and content from <noscript> is not visible. Setting this property to true forces Aspose.Words to ignore all <noscript> elements and helps to produce documents that look closer to what is seen in browsers.

PreferredControlType

Gets or sets preferred type of document nodes that will represent imported <input> and <select> elements. Default value is Aspose.Words.Loading.HtmlControlType.FormField.

public HtmlControlType PreferredControlType { get; set; }

Property Value

HtmlControlType

Remarks

Please note that setting this property does not guarantee that all imported controls will be of the specified type. If an HTML control is not representable with document nodes of the preferred type, Aspose.Words will use a compatible Aspose.Words.Loading.HtmlControlType for that control.

SupportFontFaceRules

Gets or sets a value indicating whether to support @font-face rules and whether to load declared fonts. Default value is false.

public bool SupportFontFaceRules { get; set; }

Property Value

bool

Remarks

If this option is enabled, fonts declared in @font-face rules are loaded and embedded into the resulting document's font definitions (see Aspose.Words.DocumentBase.FontInfos). This makes the loaded fonts available for rendering but doesn't automatically enable embedding of the fonts upon saving. In order to save the document with loaded fonts, the Aspose.Words.Fonts.FontInfoCollection.EmbedTrueTypeFonts property of the Aspose.Words.DocumentBase.FontInfos collection should be set to true.

Supported font formats are TTF, EOT, and WOFF.

@font-face rules are not supported when loading SVG images.

SupportVml

Gets or sets a value indicating whether to support VML images.

public bool SupportVml { get; set; }

Property Value

bool

WebRequestTimeout

The number of milliseconds to wait before the web request times out. The default value is 100000 milliseconds (100 seconds).

public int WebRequestTimeout { get; set; }

Property Value

int

Remarks

The number of milliseconds that Aspose.Words waits for a response, when loading external resources (images, style sheets) linked in HTML and MHTML documents.