HtmlSaveOptions class
HtmlSaveOptions class
Can be used to specify additional options when saving a document into the SaveFormat.Html, SaveFormat.Mhtml, SaveFormat.Epub, SaveFormat.Azw3 or SaveFormat.Mobi format. To learn more, visit the Specify Save Options documentation article.
Inheritance: HtmlSaveOptions → SaveOptions
Constructors
Name | Description |
---|---|
HtmlSaveOptions() | Initializes a new instance of this class that can be used to save a document in the SaveFormat.Html format. |
HtmlSaveOptions(saveFormat) | Initializes a new instance of this class that can be used to save a document in the SaveFormat.Html, SaveFormat.Mhtml, SaveFormat.Epub, SaveFormat.Azw3 or SaveFormat.Mobi format. |
Properties
Name | Description |
---|---|
allowEmbeddingPostScriptFonts | Gets 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 .(Inherited from SaveOptions) |
allowNegativeIndent | Specifies whether negative left and right indents of paragraphs are normalized when saving to HTML, MHTML or EPUB. Default value is false . |
cssClassNamePrefix | 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. |
cssSavingCallback | Allows to control how CSS styles are saved when a document is saved to HTML, MHTML or EPUB. |
cssStyleSheetFileName | 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. |
cssStyleSheetType | Specifies how CSS (Cascading Style Sheet) styles are exported to HTML, MHTML or EPUB. Default value is CssStyleSheetType.Inline for HTML/MHTML and CssStyleSheetType.External for EPUB. |
defaultTemplate | Gets or sets path to default template (including filename). Default value for this property is empty string . (Inherited from SaveOptions) |
dml3DEffectsRenderingMode | Gets or sets a value determining how 3D effects are rendered. (Inherited from SaveOptions) |
dmlEffectsRenderingMode | Gets or sets a value determining how DrawingML effects are rendered. (Inherited from SaveOptions) |
dmlRenderingMode | Gets or sets a value determining how DrawingML shapes are rendered. (Inherited from SaveOptions) |
documentPartSavingCallback | Allows to control how document parts are saved when a document is saved to HTML or EPUB. |
documentSplitCriteria | Specifies how the document should be split when saving to SaveFormat.Html, SaveFormat.Epub or SaveFormat.Azw3 format. Default is DocumentSplitCriteria.None for HTML and DocumentSplitCriteria.HeadingParagraph for EPUB and AZW3. |
documentSplitHeadingLevel | Specifies the maximum level of headings at which to split the document. Default value is 2 . |
encoding | Specifies the encoding to use when exporting to HTML, MHTML or EPUB. Default value is . |
exportCidUrlsForMhtmlResources | Specifies whether to use CID (Content-ID) URLs to reference resources (images, fonts, CSS) included in MHTML documents. Default value is false . |
exportDocumentProperties | Specifies whether to export built-in and custom document properties to HTML, MHTML or EPUB. Default value is false . |
exportDropDownFormFieldAsText | Controls how drop-down form fields are saved to HTML or MHTML. Default value is false . |
exportFontResources | Specifies whether font resources should be exported to HTML, MHTML or EPUB. Default is false . |
exportFontsAsBase64 | Specifies whether fonts resources should be embedded to HTML in Base64 encoding. Default is false . |
exportGeneratorName | When true , causes the name and version of Aspose.Words to be embedded into produced files. Default value is true .(Inherited from SaveOptions) |
exportHeadersFootersMode | Specifies how headers and footers are output to HTML, MHTML or EPUB. Default value is ExportHeadersFootersMode.PerSection for HTML/MHTML and ExportHeadersFootersMode.None for EPUB. |
exportImagesAsBase64 | Specifies whether images are saved in Base64 format to the output HTML, MHTML or EPUB. Default is false . |
exportLanguageInformation | Specifies whether language information is exported to HTML, MHTML or EPUB. Default is false . |
exportListLabels | Controls how list labels are output to HTML, MHTML or EPUB. Default value is ExportListLabels.Auto. |
exportOriginalUrlForLinkedImages | Specifies whether original URL should be used as the URL of the linked images. Default value is false . |
exportPageMargins | Specifies whether page margins is exported to HTML, MHTML or EPUB. Default is false . |
exportPageSetup | Specifies whether page setup is exported to HTML, MHTML or EPUB. Default is false . |
exportRelativeFontSize | Specifies whether font sizes should be output in relative units when saving to HTML, MHTML or EPUB. Default is false . |
exportRoundtripInformation | 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. |
exportShapesAsSvg | Controls whether Shape nodes are converted to SVG images when saving to HTML, MHTML, EPUB or AZW3. Default value is false . |
exportTextInputFormFieldAsText | Controls how text input form fields are saved to HTML or MHTML. Default value is false . |
exportTocPageNumbers | Specifies whether to write page numbers to table of contents when saving HTML, MHTML and EPUB. Default value is false . |
exportXhtmlTransitional | 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 (HtmlVersion.Html5) the DOCTYPE declaration is always written. |
fontResourcesSubsettingSizeThreshold | Controls which font resources need subsetting when saving to HTML, MHTML or EPUB. Default is 0 . |
fontSavingCallback | Allows to control how fonts are saved when a document is saved to HTML, MHTML or EPUB. |
fontsFolder | Specifies the physical folder where fonts are saved when exporting a document to HTML. Default is an empty string. |
fontsFolderAlias | Specifies the name of the folder used to construct font URIs written into an HTML document. Default is an empty string. |
htmlVersion | Specifies version of HTML standard that should be used when saving the document to HTML or MHTML. Default value is HtmlVersion.Xhtml. |
imageResolution | Specifies the output resolution for images when exporting to HTML, MHTML or EPUB. Default is 96 dpi . |
imageSavingCallback | Allows to control how images are saved when a document is saved to HTML, MHTML or EPUB. |
imagesFolder | Specifies the physical folder where images are saved when exporting a document to HTML format. Default is an empty string. |
imagesFolderAlias | Specifies the name of the folder used to construct image URIs written into an HTML document. Default is an empty string. |
imlRenderingMode | Gets or sets a value determining how ink (InkML) objects are rendered. (Inherited from SaveOptions) |
memoryOptimization | Gets or sets value determining if memory optimization should be performed before saving the document. Default value for this property is false .(Inherited from SaveOptions) |
metafileFormat | Specifies in what format metafiles are saved when exporting to HTML, MHTML, or EPUB. Default value is HtmlMetafileFormat.Png, meaning that metafiles are rendered to raster PNG images. |
navigationMapLevel | Specifies the maximum level of headings populated to the navigation map when exporting to EPUB, MOBI, or AZW3 formats. Default value is 3 . |
officeMathOutputMode | Controls how OfficeMath objects are exported to HTML, MHTML or EPUB. Default value is HtmlOfficeMathOutputMode.Image. |
prettyFormat | When true , pretty formats output where applicable. Default value is false .(Inherited from SaveOptions) |
removeJavaScriptFromLinks | Specifies whether JavaScript will be removed from links. Default is false . |
replaceBackslashWithYenSign | Specifies whether backslash characters should be replaced with yen signs. Default value is false . |
resolveFontNames | Specifies whether font family names used in the document are resolved and substituted according to Document.fontSettings when being written into HTML-based formats. |
resourceFolder | 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. |
resourceFolderAlias | Specifies the name of the folder used to construct URIs of all resources written into an HTML document. Default is an empty string. |
saveFormat | Specifies the format in which the document will be saved if this save options object is used. Can be SaveFormat.Html, SaveFormat.Mhtml, SaveFormat.Epub, SaveFormat.Azw3 or SaveFormat.Mobi. |
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 . |
tableWidthOutputMode | Controls how table, row and cell widths are exported to HTML, MHTML or EPUB. Default value is HtmlElementSizeOutputMode.All. |
tempFolder | 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.(Inherited from SaveOptions) |
updateAmbiguousTextFont | Determines whether the font attributes will be changed according to the character code being used. (Inherited from SaveOptions) |
updateCreatedTimeProperty | Gets or sets a value determining whether the BuiltInDocumentProperties.createdTime property is updated before saving. Default value is false ;(Inherited from SaveOptions) |
updateFields | Gets 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 .(Inherited from SaveOptions) |
updateLastPrintedProperty | Gets or sets a value determining whether the BuiltInDocumentProperties.lastPrinted property is updated before saving. (Inherited from SaveOptions) |
updateLastSavedTimeProperty | Gets or sets a value determining whether the BuiltInDocumentProperties.lastSavedTime property is updated before saving. (Inherited from SaveOptions) |
useAntiAliasing | Gets or sets a value determining whether or not to use anti-aliasing for rendering. (Inherited from SaveOptions) |
useHighQualityRendering | Gets or sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms. (Inherited from SaveOptions) |
Methods
Name | Description |
---|---|
createSaveOptions(saveFormat) | Creates a save options object of a class suitable for the specified save format. (Inherited from SaveOptions) |
createSaveOptions(fileName) | Creates a save options object of a class suitable for the file extension specified in the given file name. (Inherited from SaveOptions) |
Examples
Shows how to use a specific encoding when saving a document to .epub.
let doc = new aw.Document(base.myDir + "Rendering.docx");
// Use a SaveOptions object to specify the encoding for a document that we will save.
let saveOptions = new aw.Saving.HtmlSaveOptions();
saveOptions.saveFormat = aw.SaveFormat.Epub;
saveOptions.encoding = "utf-8";
// 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.documentSplitCriteria = aw.Saving.DocumentSplitCriteria.HeadingParagraph;
// Specify that we want to export document properties.
saveOptions.exportDocumentProperties = true;
doc.save(base.artifactsDir + "HtmlSaveOptions.Doc2EpubSaveOptions.epub", saveOptions);
Shows how to specify the folder for storing linked images after saving to .html.
let doc = new aw.Document(base.myDir + "Rendering.docx");
let imagesDir = path.join(base.artifactsDir, "SaveHtmlWithOptions");
if (fs.existsSync(imagesDir)) {
fs.rmSync(imagesDir, { recursive: true, force: true });
}
fs.mkdirSync(imagesDir, { recursive: true });
// Set an option to export form fields as plain text instead of HTML input elements.
let options = new aw.Saving.HtmlSaveOptions(aw.SaveFormat.Html);
options.exportTextInputFormFieldAsText = true;
options.imagesFolder = imagesDir;
doc.save(base.artifactsDir + "HtmlSaveOptions.SaveHtmlWithOptions.html", options);
See Also
- module Aspose.Words.Saving
- class SaveOptions