HtmlLoadOptions class

HtmlLoadOptions class

Allows to specify additional options when loading HTML document into a Document object. To learn more, visit the Specify Load Options documentation article.

Inheritance: HtmlLoadOptionsLoadOptions

Constructors

NameDescription
HtmlLoadOptions()Initializes a new instance of this class with default values.
HtmlLoadOptions(password)A shortcut to initialize a new instance of this class with the specified password to load an encrypted document.
HtmlLoadOptions(load_format, password, base_uri)A shortcut to initialize a new instance of this class with properties set to the specified values.

Properties

NameDescription
base_uriGets or sets the string that will be used to resolve relative URIs found in the document into absolute URIs when required. Can be None or empty string. Default is None.
(Inherited from LoadOptions)
block_import_modeGets or sets a value that specifies how properties of block-level elements are imported. Default value is BlockImportMode.MERGE.
convert_metafiles_to_pngGets or sets whether to convert metafile(Wmf or Emf) images to Png image format.
(Inherited from LoadOptions)
convert_shape_to_office_mathGets or sets whether to convert shapes with EquationXML to Office Math objects.
(Inherited from LoadOptions)
convert_svg_to_emfGets 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.
encodingGets or sets the encoding that will be used to load an HTML, TXT, or CHM document if the encoding is not specified inside the document. Can be None. Default is None.
(Inherited from LoadOptions)
font_settingsAllows to specify document font settings.
(Inherited from LoadOptions)
ignore_noscript_elementsGets or sets a value indicating whether to ignore <noscript> HTML elements. Default value is False.
ignore_ole_dataSpecifies whether to ignore the OLE data.
(Inherited from LoadOptions)
language_preferencesGets language preferences that will be used when document is loading.
(Inherited from LoadOptions)
load_formatSpecifies the format of the document to be loaded. Default is LoadFormat.AUTO.
(Inherited from LoadOptions)
msw_versionAllows to specify that the document loading process should match a specific MS Word version. Default value is MsWordVersion.WORD2019
(Inherited from LoadOptions)
passwordGets or sets the password for opening an encrypted document. Can be None or empty string. Default is None.
(Inherited from LoadOptions)
preferred_control_typeGets or sets preferred type of document nodes that will represent imported <input> and <select> elements. Default value is HtmlControlType.FORM_FIELD.
preserve_include_picture_fieldGets or sets whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats. The default value is False.
(Inherited from LoadOptions)
progress_callbackCalled during loading a document and accepts data about loading progress.
(Inherited from LoadOptions)
resource_loading_callbackAllows to control how external resources (images, style sheets) are loaded when a document is imported from HTML, MHTML.
(Inherited from LoadOptions)
support_font_face_rulesGets or sets a value indicating whether to support @font-face rules and whether to load declared fonts. Default value is False.
support_vmlGets or sets a value indicating whether to support VML images.
temp_folderAllows to use temporary files when reading document. By default this property is None and no temporary files are used.
(Inherited from LoadOptions)
update_dirty_fieldsSpecifies whether to update the fields with the dirty attribute.
(Inherited from LoadOptions)
use_system_lcidGets or sets whether to use LCID value obtained from Windows registry to determine page setup default margins.
(Inherited from LoadOptions)
warning_callbackCalled during a load operation, when an issue is detected that might result in data or formatting fidelity loss.
(Inherited from LoadOptions)
web_request_timeoutThe number of milliseconds to wait before the web request times out. The default value is 100000 milliseconds (100 seconds).

Examples

Shows how to support conditional comments while loading an HTML document.

load_options = aw.loading.HtmlLoadOptions()
# If the value is true, then we take VML code into account while parsing the loaded document.
load_options.support_vml = support_vml
# This document contains a JPEG image within "<!--[if gte vml 1]>" tags,
# and a different PNG image within "<![if !vml]>" tags.
# If we set the "SupportVml" flag to "true", then Aspose.Words will load the JPEG.
# If we set this flag to "false", then Aspose.Words will only load the PNG.
doc = aw.Document(file_name=MY_DIR + 'VML conditional.htm', load_options=load_options)
if support_vml:
    self.assertEqual(aw.drawing.ImageType.JPEG, doc.get_child(aw.NodeType.SHAPE, 0, True).as_shape().image_data.image_type)
else:
    self.assertEqual(aw.drawing.ImageType.PNG, doc.get_child(aw.NodeType.SHAPE, 0, True).as_shape().image_data.image_type)

See Also