HtmlSaveOptions Class
Represents options for saving to HyperText Markup Language (HTML) format.
public sealed class HtmlSaveOptions : SaveOptions
Public NotInheritable Class HtmlSaveOptions
Inherits SaveOptions
- Inheritance:
- System.ObjectHtmlSaveOptions
Remarks
Pictures are exported only if one of this is true:
- HtmlType is Mhtml
- Save(String) or Save(String, SaveOptions) overload is used
- FilesDirectoryPath or EmbedImages is specified
Constructors
HtmlSaveOptions()
Initializes a new instance of the HtmlSaveOptions class.
Properties
ContentType
Gets the content-type for HTML file format:
public override string ContentType { get; }
Public Overrides ReadOnly Property ContentType As String
Property Value
- System.String
The content-type for HTML file format.
Overrides
EmbedImages
Gets or sets a value indicating whether images are embedded directly within the HTML file in form of Base64 encoding.
Property Value
- System.Boolean
true if images are embedded directly within the HTML file in form of Base64 encoding; otherwise, false.
Remarks
If the value of this property is true then each image element will contain raw image data in its source attribute. This value doesn't change the pictures export behavior when using Mhtml.
EmbedOnlineVideos
Gets or sets a value indicating whether Pictures whose OnlineVideo is not null are exported as EmbeddedHtml.
Property Value
- System.Boolean
true if Pictures whose OnlineVideo is not null are exported as EmbeddedHtml; otherwise, false.
Encoding
Gets or sets the encoding for the HTML file.
Property Value
- System.Text.Encoding
The encoding for the HTML file.
Exceptions
- System.ArgumentNullException
Value is set to null.
FilesDirectoryPath
Gets or sets the physical directory where Pictures will be saved.
Property Value
- System.String
The physical directory where Pictures will be saved.
Remarks
If value is null or System.String.Empty and HTML export is called with Save(String) or Save(String, SaveOptions) overload, value will be automatically set to htmlFileNameWithoutExtension + "_files". This directory will be created in the same location as HTML file.
FilesDirectorySrcPath
Gets or sets the relative directory that will be used when referencing Pictures in the HTML.
public string FilesDirectorySrcPath { get; set; }
Public Property FilesDirectorySrcPath As String
Property Value
- System.String
The relative directory that will be used when referencing Pictures in the HTML.
Remarks
If value is null or System.String.Empty and HTML export is called with Save(String) or Save(String, SaveOptions) overload, value will be automatically set to htmlFileNameWithoutExtension + "_files".
HtmlType
Gets or sets the type of export.
Property Value
Remarks
For Html and HtmlInline values, pictures will be exported only if Save(String) or Save(String, SaveOptions) overload is used or if FilesDirectoryPath is specified or if EmbedImages is set to true.
For Mhtml value, pictures are always exported.
IgnoreStyles
Gets or sets a value indicating whether to ignore styling information when generating an HTML.
Use this property if you want that generated HTML contains only HTML elements without any style attributes.
Default value is false meaning that document element's styling information will be written to output HTML.
Property Value
- System.Boolean
true if styling information should be ignored when generating an HTML; otherwise, false.
KeepImageLinks
Gets or sets a value indicating whether to keep linked images as links.
Property Value
- System.Boolean
true if linked images should be kept as links; otherwise, false.
Remarks
If the value is set to true, all linked images in the model will not be downloaded to FilesDirectoryPath. They will be exported to HTML with original source paths. Otherwise, images will be downloaded and their links will be replaced with local paths.
UseContentIdHeaders
Gets or sets a value indicating whether CID (Content-ID) should be used to reference images within MHTML file.
Property Value
- System.Boolean
true to reference images with Content-ID headers, false to reference images with Content-Location headers.
Remarks
Some MHTML viewers fail to load image resources when they're referenced with Content-Location headers, for example MS Outlook. In that case, try exporting the images with CID references by setting UseContentIdHeaders to true.
UseSemanticElements
Gets or sets a value indicating whether to use semantic elements when generating an HTML.
To maintain backward compatibility, default value is false.
The type of the semantic element that will be used is inferred either from a document element type, some of its properties or its style. For example, <h1> to <h6> HTML elements will be used for paragraphs with 'Heading 1' to 'Heading 6' styles. This feature is currently not fully implemented. Support for various HTML semantic elements (especially those defined in HTML5) will be added gradually.
Property Value
- System.Boolean
true if semantic HTML elements should be used when generating an HTML; otherwise, false.
Inherited Properties
DocxDefault | Gets the default saving options for Microsoft Word file format. Word file will be saved in Docx format. (Inherited from SaveOptions) |
HtmlDefault | Gets the default saving options for HyperText Markup Language (HTML) format. (Inherited from SaveOptions) |
ImageDefault | Gets the default saving options for image file format. Image will be saved in Bmp format. (Inherited from SaveOptions) |
OdtDefault | Gets the default saving options for Open Document file format. (Inherited from SaveOptions) |
PageCount | Gets or sets the number of pages which should be saved. (Inherited from SaveOptions) |
PageNumber | Gets or sets the zero-based page number of the document's page which should be saved. (Inherited from SaveOptions) |
PdfDefault | Gets the default saving options for Portable Document Format (PDF). (Inherited from SaveOptions) |
RtfDefault | Gets the default saving options for Rich Text (RTF) format. (Inherited from SaveOptions) |
TxtDefault | Gets the default saving options for Plain Text (TXT) format. (Inherited from SaveOptions) |
XmlDefault | Gets the default saving options for XML file format. (Inherited from SaveOptions) |
XpsDefault | Gets the default saving options for XML Paper Specification (XPS) format. (Inherited from SaveOptions) |