Aspose::Words::Saving::HtmlSaveOptions class

HtmlSaveOptions class

Can be used to specify additional options when saving a document into the Html, Mhtml, Epub, Azw3 or Mobi format. To learn more, visit the Specify Save Options documentation article.

class HtmlSaveOptions : public SaveOptions

Methods

MethodDescription
HtmlSaveOptions()Initializes a new instance of this class that can be used to save a document in the Html format.
HtmlSaveOptions(Aspose::Words::SaveFormat)Initializes a new instance of this class that can be used to save a document in the Html, Mhtml, Epub, Azw3 or Mobi format.
get_AllowNegativeIndent() constSpecifies whether negative left and right indents of paragraphs are normalized when saving to HTML, MHTML or EPUB. Default value is false.
get_CssClassNamePrefix() constSpecifies a prefix which is added to all CSS class names. Default value is an empty string and generated CSS class names have no common prefix.
get_CssSavingCallback() constAllows to control how CSS styles are saved when a document is saved to HTML, MHTML or EPUB.
get_CssStyleSheetFileName() constSpecifies the path and the name of the Cascading Style Sheet (CSS) file written when a document is exported to HTML. Default is an empty string.
get_CssStyleSheetType() constSpecifies how CSS (Cascading Style Sheet) styles are exported to HTML, MHTML or EPUB. Default value is Inline for HTML/MHTML and External for EPUB.
get_DocumentPartSavingCallback() constAllows to control how document parts are saved when a document is saved to HTML or EPUB.
get_DocumentSplitCriteria() constSpecifies how the document should be split when saving to Html, Epub or Azw3 format. Default is None for HTML and HeadingParagraph for EPUB and AZW3.
get_DocumentSplitHeadingLevel() constSpecifies the maximum level of headings at which to split the document. Default value is 2.
get_Encoding() constSpecifies the encoding to use when exporting to HTML, MHTML or EPUB. Default value is new UTF8Encoding(false) (UTF-8 without BOM).
get_ExportCidUrlsForMhtmlResources() constSpecifies whether to use CID (Content-ID) URLs to reference resources (images, fonts, CSS) included in MHTML documents. Default value is false.
get_ExportDocumentProperties() constSpecifies whether to export built-in and custom document properties to HTML, MHTML or EPUB. Default value is false.
get_ExportDropDownFormFieldAsText() constControls how drop-down form fields are saved to HTML or MHTML. Default value is false.
get_ExportFontResources() constSpecifies whether font resources should be exported to HTML, MHTML or EPUB. Default is false.
get_ExportFontsAsBase64() constSpecifies whether fonts resources should be embedded to HTML in Base64 encoding. Default is false.
get_ExportHeadersFootersMode() constSpecifies how headers and footers are output to HTML, MHTML or EPUB. Default value is PerSection for HTML/MHTML and None for EPUB.
get_ExportImagesAsBase64()Specifies whether images are saved in Base64 format to the output HTML, MHTML or EPUB. Default is false.
get_ExportLanguageInformation() constSpecifies whether language information is exported to HTML, MHTML or EPUB. Default is false.
get_ExportListLabels() constControls how list labels are output to HTML, MHTML or EPUB. Default value is Auto.
get_ExportOriginalUrlForLinkedImages() constSpecifies whether original URL should be used as the URL of the linked images. Default value is false.
get_ExportPageMargins() constSpecifies whether page margins is exported to HTML, MHTML or EPUB. Default is false.
get_ExportPageSetup() constSpecifies whether page setup is exported to HTML, MHTML or EPUB. Default is false.
get_ExportRelativeFontSize() constSpecifies whether font sizes should be output in relative units when saving to HTML, MHTML or EPUB. Default is false.
get_ExportRoundtripInformation() constSpecifies whether to write the roundtrip information when saving to HTML, MHTML or EPUB. Default value is true for HTML and false for MHTML and EPUB.
get_ExportShapesAsSvg()Controls whether Shape nodes are converted to SVG images when saving to HTML, MHTML, EPUB or AZW3. Default value is false.
get_ExportTextInputFormFieldAsText() constControls how text input form fields are saved to HTML or MHTML. Default value is false.
get_ExportTocPageNumbers() constSpecifies whether to write page numbers to table of contents when saving HTML, MHTML and EPUB. Default value is false.
get_ExportXhtmlTransitional() constSpecifies whether to write the DOCTYPE declaration when saving to HTML or MHTML. When true, writes a DOCTYPE declaration in the document prior to the root element. Default value is false. When saving to EPUB or HTML5 (Html5) the DOCTYPE declaration is always written.
get_FontResourcesSubsettingSizeThreshold() constControls which font resources need subsetting when saving to HTML, MHTML or EPUB. Default is 0.
get_FontSavingCallback() constAllows to control how fonts are saved when a document is saved to HTML, MHTML or EPUB.
get_FontsFolder() constSpecifies the physical folder where fonts are saved when exporting a document to HTML. Default is an empty string.
get_FontsFolderAlias() constSpecifies the name of the folder used to construct font URIs written into an HTML document. Default is an empty string.
get_HtmlVersion() constSpecifies version of HTML standard that should be used when saving the document to HTML or MHTML. Default value is Xhtml.
get_ImageResolution()Specifies the output resolution for images when exporting to HTML, MHTML or EPUB. Default is 96 dpi.
get_ImageSavingCallback()Allows to control how images are saved when a document is saved to HTML, MHTML or EPUB.
get_ImagesFolder() constSpecifies the physical folder where images are saved when exporting a document to HTML format. Default is an empty string.
get_ImagesFolderAlias() constSpecifies the name of the folder used to construct image URIs written into an HTML document. Default is an empty string.
get_MetafileFormat()Specifies in what format metafiles are saved when exporting to HTML, MHTML, or EPUB. Default value is Png, meaning that metafiles are rendered to raster PNG images.
get_NavigationMapLevel() constSpecifies the maximum level of headings populated to the navigation map when exporting to EPUB, MOBI, or AZW3 formats. Default value is 3.
get_OfficeMathOutputMode() constControls how OfficeMath objects are exported to HTML, MHTML or EPUB. Default value is Image.
get_RemoveJavaScriptFromLinks() constSpecifies whether JavaScript will be removed from links. Default is false.
get_ReplaceBackslashWithYenSign() constSpecifies whether backslash characters should be replaced with yen signs. Default value is false.
get_ResolveFontNames() constSpecifies whether font family names used in the document are resolved and substituted according to FontSettings when being written into HTML-based formats.
get_ResourceFolder() constSpecifies a physical folder where all resources like images, fonts, and external CSS are saved when a document is exported to HTML. Default is an empty string.
get_ResourceFolderAlias() constSpecifies the name of the folder used to construct URIs of all resources written into an HTML document. Default is an empty string.
get_SaveFormat() overrideSpecifies the format in which the document will be saved if this save options object is used. Can be Html, Mhtml, Epub, Azw3 or Mobi.
get_ScaleImageToShapeSize()Specifies whether images are scaled by Aspose.Words to the bounding shape size when exporting to HTML, MHTML or EPUB. Default value is true.
get_TableWidthOutputMode() constControls how table, row and cell widths are exported to HTML, MHTML or EPUB. Default value is All.
set_AllowNegativeIndent(bool)Specifies whether negative left and right indents of paragraphs are normalized when saving to HTML, MHTML or EPUB. Default value is false.
set_CssClassNamePrefix(const System::String &)Specifies a prefix which is added to all CSS class names. Default value is an empty string and generated CSS class names have no common prefix.
set_CssSavingCallback(const System::SharedPtr<Aspose::Words::Saving::ICssSavingCallback> &)Allows to control how CSS styles are saved when a document is saved to HTML, MHTML or EPUB.
set_CssStyleSheetFileName(const System::String &)Specifies the path and the name of the Cascading Style Sheet (CSS) file written when a document is exported to HTML. Default is an empty string.
set_CssStyleSheetType(Aspose::Words::Saving::CssStyleSheetType)Specifies how CSS (Cascading Style Sheet) styles are exported to HTML, MHTML or EPUB. Default value is Inline for HTML/MHTML and External for EPUB.
set_DocumentPartSavingCallback(const System::SharedPtr<Aspose::Words::Saving::IDocumentPartSavingCallback> &)Allows to control how document parts are saved when a document is saved to HTML or EPUB.
set_DocumentSplitCriteria(Aspose::Words::Saving::DocumentSplitCriteria)Specifies how the document should be split when saving to Html, Epub or Azw3 format. Default is None for HTML and HeadingParagraph for EPUB and AZW3.
set_DocumentSplitHeadingLevel(int32_t)Specifies the maximum level of headings at which to split the document. Default value is 2.
set_Encoding(const System::SharedPtr<System::Text::Encoding> &)Specifies the encoding to use when exporting to HTML, MHTML or EPUB. Default value is new UTF8Encoding(false) (UTF-8 without BOM).
set_ExportCidUrlsForMhtmlResources(bool)Specifies whether to use CID (Content-ID) URLs to reference resources (images, fonts, CSS) included in MHTML documents. Default value is false.
set_ExportDocumentProperties(bool)Specifies whether to export built-in and custom document properties to HTML, MHTML or EPUB. Default value is false.
set_ExportDropDownFormFieldAsText(bool)Controls how drop-down form fields are saved to HTML or MHTML. Default value is false.
set_ExportFontResources(bool)Specifies whether font resources should be exported to HTML, MHTML or EPUB. Default is false.
set_ExportFontsAsBase64(bool)Specifies whether fonts resources should be embedded to HTML in Base64 encoding. Default is false.
set_ExportHeadersFootersMode(Aspose::Words::Saving::ExportHeadersFootersMode)Specifies how headers and footers are output to HTML, MHTML or EPUB. Default value is PerSection for HTML/MHTML and None for EPUB.
set_ExportImagesAsBase64(bool)Specifies whether images are saved in Base64 format to the output HTML, MHTML or EPUB. Default is false.
set_ExportLanguageInformation(bool)Specifies whether language information is exported to HTML, MHTML or EPUB. Default is false.
set_ExportListLabels(Aspose::Words::Saving::ExportListLabels)Controls how list labels are output to HTML, MHTML or EPUB. Default value is Auto.
set_ExportOriginalUrlForLinkedImages(bool)Specifies whether original URL should be used as the URL of the linked images. Default value is false.
set_ExportPageMargins(bool)Specifies whether page margins is exported to HTML, MHTML or EPUB. Default is false.
set_ExportPageSetup(bool)Specifies whether page setup is exported to HTML, MHTML or EPUB. Default is false.
set_ExportRelativeFontSize(bool)Specifies whether font sizes should be output in relative units when saving to HTML, MHTML or EPUB. Default is false.
set_ExportRoundtripInformation(bool)Specifies whether to write the roundtrip information when saving to HTML, MHTML or EPUB. Default value is true for HTML and false for MHTML and EPUB.
set_ExportShapesAsSvg(bool)Controls whether Shape nodes are converted to SVG images when saving to HTML, MHTML, EPUB or AZW3. Default value is false.
set_ExportTextInputFormFieldAsText(bool)Controls how text input form fields are saved to HTML or MHTML. Default value is false.
set_ExportTocPageNumbers(bool)Specifies whether to write page numbers to table of contents when saving HTML, MHTML and EPUB. Default value is false.
set_ExportXhtmlTransitional(bool)Specifies whether to write the DOCTYPE declaration when saving to HTML or MHTML. When true, writes a DOCTYPE declaration in the document prior to the root element. Default value is false. When saving to EPUB or HTML5 (Html5) the DOCTYPE declaration is always written.
set_FontResourcesSubsettingSizeThreshold(int32_t)Controls which font resources need subsetting when saving to HTML, MHTML or EPUB. Default is 0.
set_FontSavingCallback(const System::SharedPtr<Aspose::Words::Saving::IFontSavingCallback> &)Allows to control how fonts are saved when a document is saved to HTML, MHTML or EPUB.
set_FontsFolder(const System::String &)Specifies the physical folder where fonts are saved when exporting a document to HTML. Default is an empty string.
set_FontsFolderAlias(const System::String &)Specifies the name of the folder used to construct font URIs written into an HTML document. Default is an empty string.
set_HtmlVersion(Aspose::Words::Saving::HtmlVersion)Specifies version of HTML standard that should be used when saving the document to HTML or MHTML. Default value is Xhtml.
set_ImageResolution(int32_t)Specifies the output resolution for images when exporting to HTML, MHTML or EPUB. Default is 96 dpi.
set_ImageSavingCallback(const System::SharedPtr<Aspose::Words::Saving::IImageSavingCallback> &)Allows to control how images are saved when a document is saved to HTML, MHTML or EPUB.
set_ImagesFolder(const System::String &)Specifies the physical folder where images are saved when exporting a document to HTML format. Default is an empty string.
set_ImagesFolderAlias(const System::String &)Specifies the name of the folder used to construct image URIs written into an HTML document. Default is an empty string.
set_MetafileFormat(Aspose::Words::Saving::HtmlMetafileFormat)Specifies in what format metafiles are saved when exporting to HTML, MHTML, or EPUB. Default value is Png, meaning that metafiles are rendered to raster PNG images.
set_NavigationMapLevel(int32_t)Specifies the maximum level of headings populated to the navigation map when exporting to EPUB, MOBI, or AZW3 formats. Default value is 3.
set_OfficeMathOutputMode(Aspose::Words::Saving::HtmlOfficeMathOutputMode)Controls how OfficeMath objects are exported to HTML, MHTML or EPUB. Default value is Image.
set_RemoveJavaScriptFromLinks(bool)Specifies whether JavaScript will be removed from links. Default is false.
set_ReplaceBackslashWithYenSign(bool)Specifies whether backslash characters should be replaced with yen signs. Default value is false.
set_ResolveFontNames(bool)Specifies whether font family names used in the document are resolved and substituted according to FontSettings when being written into HTML-based formats.
set_ResourceFolder(const System::String &)Specifies a physical folder where all resources like images, fonts, and external CSS are saved when a document is exported to HTML. Default is an empty string.
set_ResourceFolderAlias(const System::String &)Specifies the name of the folder used to construct URIs of all resources written into an HTML document. Default is an empty string.
set_SaveFormat(Aspose::Words::SaveFormat) overrideSpecifies the format in which the document will be saved if this save options object is used. Can be Html, Mhtml, Epub, Azw3 or Mobi.
set_ScaleImageToShapeSize(bool)Specifies whether images are scaled by Aspose.Words to the bounding shape size when exporting to HTML, MHTML or EPUB. Default value is true.
set_TableWidthOutputMode(Aspose::Words::Saving::HtmlElementSizeOutputMode)Controls how table, row and cell widths are exported to HTML, MHTML or EPUB. Default value is All.
static CreateSaveOptions(Aspose::Words::SaveFormat)Creates a save options object of a class suitable for the specified save format.
static CreateSaveOptions(const System::String &)Creates a save options object of a class suitable for the file extension specified in the given file name.
get_AllowEmbeddingPostScriptFonts() constGets or sets a boolean value indicating whether to allow embedding fonts with PostScript outlines when embedding TrueType fonts in a document upon it is saved. The default value is false.
get_CustomTimeZoneInfo() constGets or sets custom local time zone used for date/time fields.
get_DefaultTemplate() constGets or sets path to default template (including filename). Default value for this property is empty string.
get_Dml3DEffectsRenderingMode() constGets or sets a value determining how 3D effects are rendered.
virtual get_DmlEffectsRenderingMode()Gets or sets a value determining how DrawingML effects are rendered.
get_DmlRenderingMode() constGets or sets a value determining how DrawingML shapes are rendered.
get_ExportGeneratorName() constWhen true, causes the name and version of Aspose.Words to be embedded into produced files. Default value is true.
get_ImlRenderingMode() constGets or sets a value determining how ink (InkML) objects are rendered.
get_MemoryOptimization() constGets or sets value determining if memory optimization should be performed before saving the document. Default value for this property is false.
get_PrettyFormat() constWhen true, pretty formats output where applicable. Default value is false.
get_ProgressCallback() constCalled during saving a document and accepts data about saving progress.
virtual get_SaveFormat()Specifies the format in which the document will be saved if this save options object is used.
get_TempFolder() constSpecifies the folder for temporary files used when saving to a DOC or DOCX file. By default, this property is null and no temporary files are used.
get_UpdateAmbiguousTextFont() constDetermines whether the font attributes will be changed according to the character code being used.
get_UpdateCreatedTimeProperty() constGets or sets a value determining whether the CreatedTime property is updated before saving. Default value is false;
get_UpdateFields() constGets or sets a value determining if fields of certain types should be updated before saving the document to a fixed page format. Default value for this property is true.
get_UpdateLastPrintedProperty() constGets or sets a value determining whether the LastPrinted property is updated before saving.
get_UpdateLastSavedTimeProperty() constGets or sets a value determining whether the LastSavedTime property is updated before saving.
get_UpdateOleControlImages() constGets a value determining whether OLE controls presentation image will be updated.
get_UseAntiAliasing() constGets or sets a value determining whether or not to use anti-aliasing for rendering.
get_UseHighQualityRendering() constGets or sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms.
set_AllowEmbeddingPostScriptFonts(bool)Sets a boolean value indicating whether to allow embedding fonts with PostScript outlines when embedding TrueType fonts in a document upon it is saved. The default value is false.
set_CustomTimeZoneInfo(const System::SharedPtr<System::TimeZoneInfo> &)Sets custom local time zone used for date/time fields.
set_DefaultTemplate(const System::String &)Sets path to default template (including filename). Default value for this property is empty string.
set_Dml3DEffectsRenderingMode(Aspose::Words::Saving::Dml3DEffectsRenderingMode)Sets a value determining how 3D effects are rendered.
virtual set_DmlEffectsRenderingMode(Aspose::Words::Saving::DmlEffectsRenderingMode)Sets a value determining how DrawingML effects are rendered.
set_DmlRenderingMode(Aspose::Words::Saving::DmlRenderingMode)Sets a value determining how DrawingML shapes are rendered.
set_ExportGeneratorName(bool)When true, causes the name and version of Aspose.Words to be embedded into produced files. Default value is true.
set_ImlRenderingMode(Aspose::Words::Saving::ImlRenderingMode)Sets a value determining how ink (InkML) objects are rendered.
set_MemoryOptimization(bool)Sets value determining if memory optimization should be performed before saving the document. Default value for this property is false.
set_PrettyFormat(bool)When true, pretty formats output where applicable. Default value is false.
set_ProgressCallback(const System::SharedPtr<Aspose::Words::Saving::IDocumentSavingCallback> &)Called during saving a document and accepts data about saving progress.
virtual set_SaveFormat(Aspose::Words::SaveFormat)Specifies the format in which the document will be saved if this save options object is used.
set_TempFolder(const System::String &)Specifies the folder for temporary files used when saving to a DOC or DOCX file. By default, this property is null and no temporary files are used.
set_UpdateAmbiguousTextFont(bool)Determines whether the font attributes will be changed according to the character code being used.
set_UpdateCreatedTimeProperty(bool)Sets a value determining whether the CreatedTime property is updated before saving. Default value is false;
set_UpdateFields(bool)Sets a value determining if fields of certain types should be updated before saving the document to a fixed page format. Default value for this property is true.
set_UpdateLastPrintedProperty(bool)Sets a value determining whether the LastPrinted property is updated before saving.
set_UpdateLastSavedTimeProperty(bool)Sets a value determining whether the LastSavedTime property is updated before saving.
set_UpdateOleControlImages(bool)Sets a value determining whether OLE controls presentation image will be updated.
set_UseAntiAliasing(bool)Sets a value determining whether or not to use anti-aliasing for rendering.
set_UseHighQualityRendering(bool)Sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms.

Examples

Shows how to use a specific encoding when saving a document to .epub.

auto doc = System::MakeObject<Aspose::Words::Document>(System::String(get_MyDir() + u"Rendering.docx"));

// Use a SaveOptions object to specify the encoding for a document that we will save.
auto saveOptions = System::MakeObject<Aspose::Words::Saving::HtmlSaveOptions>();
saveOptions->set_SaveFormat(SaveFormat::Epub);
saveOptions->set_Encoding(System::Text::Encoding::get_UTF8());

// By default, an output .epub document will have all its contents in one HTML part.
// A split criterion allows us to segment the document into several HTML parts.
// We will set the criteria to split the document into heading paragraphs.
// This is useful for readers who cannot read HTML files more significant than a specific size.
saveOptions->set_DocumentSplitCriteria(DocumentSplitCriteria::HeadingParagraph);

// Specify that we want to export document properties.
saveOptions->set_ExportDocumentProperties(true);

doc->Save(get_ArtifactsDir() + u"HtmlSaveOptions.Doc2EpubSaveOptions.epub", saveOptions);

Shows how to specify the folder for storing linked images after saving to .html.

auto doc = System::MakeObject<Aspose::Words::Document>(System::String(get_MyDir() + u"Rendering.docx"));

System::String imagesDir = System::IO::Path::Combine(get_ArtifactsDir(), u"SaveHtmlWithOptions");

if (System::IO::Directory::Exists(imagesDir))
{
    System::IO::Directory::Delete(imagesDir, true);
}

System::IO::Directory::CreateDirectory_(imagesDir);

// Set an option to export form fields as plain text instead of HTML input elements.
auto options = System::MakeObject<Aspose::Words::Saving::HtmlSaveOptions>(SaveFormat::Html);
options->set_ExportTextInputFormFieldAsText(true);
options->set_ImagesFolder(imagesDir);

doc->Save(get_ArtifactsDir() + u"HtmlSaveOptions.SaveHtmlWithOptions.html", options);

See Also