Aspose::Words::Loading::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.

class HtmlLoadOptions : public LoadOptions

Methods

MethodDescription
HtmlLoadOptions()Initializes a new instance of this class with default values.
HtmlLoadOptions(Aspose::Words::LoadFormat, const System::String &, const System::String &)A shortcut to initialize a new instance of this class with properties set to the specified values.
HtmlLoadOptions(const System::String &)A shortcut to initialize a new instance of this class with the specified password to load an encrypted document.
get_BlockImportMode() constGets or sets a value that specifies how properties of block-level elements are imported. Default value is Merge.
get_ConvertSvgToEmf() constGets 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.
get_IgnoreNoscriptElements() constGets or sets a value indicating whether to ignore
get_PreferredControlType() constGets or sets preferred type of document nodes that will represent imported and
get_SupportFontFaceRules() constGets or sets a value indicating whether to support @font-face rules and whether to load declared fonts. Default value is false.
get_SupportVml() constGets or sets a value indicating whether to support VML images.
get_WebRequestTimeout() constThe number of milliseconds to wait before the web request times out. The default value is 100000 milliseconds (100 seconds).
set_BlockImportMode(Aspose::Words::Loading::BlockImportMode)Sets a value that specifies how properties of block-level elements are imported. Default value is Merge.
set_ConvertSvgToEmf(bool)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.
set_IgnoreNoscriptElements(bool)Sets a value indicating whether to ignore
set_PreferredControlType(Aspose::Words::Loading::HtmlControlType)Sets preferred type of document nodes that will represent imported and
set_SupportFontFaceRules(bool)Sets a value indicating whether to support @font-face rules and whether to load declared fonts. Default value is false.
set_SupportVml(bool)Sets a value indicating whether to support VML images.
set_WebRequestTimeout(int32_t)The number of milliseconds to wait before the web request times out. The default value is 100000 milliseconds (100 seconds).
Equals(System::SharedPtr<System::Object>) overrideDetermines whether the specified object is equal in value to the current object.
LoadOptions()Initializes a new instance of this class with default values.
LoadOptions(Aspose::Words::LoadFormat, const System::String &, const System::String &)A shortcut to initialize a new instance of this class with properties set to the specified values.
LoadOptions(const System::String &)A shortcut to initialize a new instance of this class with the specified password to load an encrypted document.
get_BaseUri() constGets or sets the string that will be used to resolve relative URIs found in the document into absolute URIs when required. Can be null or empty string. Default is null.
get_ConvertMetafilesToPng() constGets or sets whether to convert metafile(Wmf or Emf) images to Png image format.
get_ConvertShapeToOfficeMath() constGets or sets whether to convert shapes with EquationXML to Office Math objects.
get_Encoding() constGets 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 null. Default is null.
get_FontSettings() constAllows to specify document font settings.
get_IgnoreOleData() constSpecifies whether to ignore the OLE data.
get_LanguagePreferences() constGets language preferences that will be used when document is loading.
get_LoadFormat() constSpecifies the format of the document to be loaded. Default is Auto.
get_MswVersion() constAllows to specify that the document loading process should match a specific MS Word version. Default value is Word2019
get_Password() constGets or sets the password for opening an encrypted document. Can be null or empty string. Default is null.
get_PreserveIncludePictureField() constGets or sets whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats. The default value is false.
get_ProgressCallback() constCalled during loading a document and accepts data about loading progress.
get_RecoveryMode() constDefines how the document should be handled if errors occur during loading. Use this property to specify whether the system should attempt to recover the document or follow another defined behavior. The default value is TryRecover.
get_ResourceLoadingCallback() constAllows to control how external resources (images, style sheets) are loaded when a document is imported from HTML, MHTML.
get_TempFolder() constAllows to use temporary files when reading document. By default this property is null and no temporary files are used.
get_UpdateDirtyFields() constSpecifies whether to update the fields with the dirty attribute.
get_UseSystemLcid() constGets or sets whether to use LCID value obtained from Windows registry to determine page setup default margins.
get_WarningCallback() constCalled during a load operation, when an issue is detected that might result in data or formatting fidelity loss.
set_BaseUri(const System::String &)Sets the string that will be used to resolve relative URIs found in the document into absolute URIs when required. Can be null or empty string. Default is null.
set_ConvertMetafilesToPng(bool)Sets whether to convert metafile(Wmf or Emf) images to Png image format.
set_ConvertShapeToOfficeMath(bool)Sets whether to convert shapes with EquationXML to Office Math objects.
set_Encoding(const System::SharedPtr<System::Text::Encoding> &)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 null. Default is null.
set_FontSettings(const System::SharedPtr<Aspose::Words::Fonts::FontSettings> &)Allows to specify document font settings.
set_IgnoreOleData(bool)Specifies whether to ignore the OLE data.
set_LoadFormat(Aspose::Words::LoadFormat)Specifies the format of the document to be loaded. Default is Auto.
set_MswVersion(Aspose::Words::Settings::MsWordVersion)Allows to specify that the document loading process should match a specific MS Word version. Default value is Word2019
set_Password(const System::String &)Sets the password for opening an encrypted document. Can be null or empty string. Default is null.
set_PreserveIncludePictureField(bool)Sets whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats. The default value is false.
set_ProgressCallback(const System::SharedPtr<Aspose::Words::Loading::IDocumentLoadingCallback> &)Called during loading a document and accepts data about loading progress.
set_RecoveryMode(Aspose::Words::Loading::DocumentRecoveryMode)Defines how the document should be handled if errors occur during loading. Use this property to specify whether the system should attempt to recover the document or follow another defined behavior. The default value is TryRecover.
set_ResourceLoadingCallback(const System::SharedPtr<Aspose::Words::Loading::IResourceLoadingCallback> &)Allows to control how external resources (images, style sheets) are loaded when a document is imported from HTML, MHTML.
set_TempFolder(const System::String &)Allows to use temporary files when reading document. By default this property is null and no temporary files are used.
set_UpdateDirtyFields(bool)Specifies whether to update the fields with the dirty attribute.
set_UseSystemLcid(bool)Sets whether to use LCID value obtained from Windows registry to determine page setup default margins.
set_WarningCallback(const System::SharedPtr<Aspose::Words::IWarningCallback> &)Called during a load operation, when an issue is detected that might result in data or formatting fidelity loss.

Examples

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

auto loadOptions = System::MakeObject<Aspose::Words::Loading::HtmlLoadOptions>();

// If the value is true, then we take VML code into account while parsing the loaded document.
loadOptions->set_SupportVml(supportVml);

// 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.
auto doc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"VML conditional.htm", loadOptions);

if (supportVml)
{
    ASSERT_EQ((System::ExplicitCast<Aspose::Words::Drawing::Shape>(doc->GetChild(NodeType::Shape, 0, true)))->get_ImageData()->get_ImageType(), ImageType::Jpeg);
}
else
{
    ASSERT_EQ((System::ExplicitCast<Aspose::Words::Drawing::Shape>(doc->GetChild(NodeType::Shape, 0, true)))->get_ImageData()->get_ImageType(), ImageType::Png);
}

See Also