Class HtmlSaveOptions

Class HtmlSaveOptions

Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)

Represents the options for saving html file.

public class HtmlSaveOptions : SaveOptions

Inheritance

objectSaveOptionsHtmlSaveOptions

Derived

EbookSaveOptions

Inherited Members

SaveOptions.m_SaveFormat, SaveOptions.SaveFormat, SaveOptions.ClearData, SaveOptions.CachedFileFolder, SaveOptions.ValidateMergedAreas, SaveOptions.MergeAreas, SaveOptions.CreateDirectory, SaveOptions.SortNames, SaveOptions.SortExternalNames, SaveOptions.RefreshChartCache, SaveOptions.WarningCallback, SaveOptions.CheckExcelRestriction, SaveOptions.UpdateSmartArt, SaveOptions.EncryptDocumentProperties, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

HtmlSaveOptions()

Creates options for saving html file.

public HtmlSaveOptions()

HtmlSaveOptions(SaveFormat)

Creates options for saving htm file.

public HtmlSaveOptions(SaveFormat saveFormat)

Parameters

saveFormat SaveFormat

The file format. It should be one of following types: Aspose.Cells.SaveFormat.Html or Aspose.Cells.SaveFormat.MHtml, otherwise the saved format will be set as Aspose.Cells.SaveFormat.Html automatically.

Properties

AddGenericFont

Indicates whether to add a generic font to CSS font-family. The default value is true

public bool AddGenericFont { get; set; }

Property Value

bool

AddTooltipText

Indicates whether adding tooltip text when the data can’t be fully displayed. The default value is false.

public bool AddTooltipText { get; set; }

Property Value

bool

AttachedFilesDirectory

The directory that the attached files will be saved to. Only for saving to html stream.

public string AttachedFilesDirectory { get; set; }

Property Value

string

AttachedFilesUrlPrefix

Specify the Url prefix of attached files such as image in the html file. Only for saving to html stream.

public string AttachedFilesUrlPrefix { get; set; }

Property Value

string

CalculateFormula

Indicates whether to calculate formulas before saving html file.

public bool CalculateFormula { get; set; }

Property Value

bool

Remarks

The default value is false.

CellCssPrefix

Gets and sets the prefix of the css name,the default value is “”.

public string CellCssPrefix { get; set; }

Property Value

string

CellNameAttribute

Specifies the attribute that indicates the CellName to be written. (e.g. If the value is “id”, then for cell “A1”, the output will be:<td id=‘A1’>). The default value is null.

public string CellNameAttribute { get; set; }

Property Value

string

CssStyles

Gets or sets the additional css styles for the formatter. Only works when Aspose.Cells.HtmlSaveOptions.SaveAsSingleFile is True. CssStyles=“body { padding: 5px }”;

public string CssStyles { get; set; }

Property Value

string

DefaultFontName

Specify the default font name for exporting html, the default font will be used when the font of style is not existing, If this property is null, Aspose.Cells will use universal font which have the same family with the original font, the default value is null.

public string DefaultFontName { get; set; }

Property Value

string

DisableCss

Indicates whether only inline styles are applied, without relying on CSS. The default value is false.

public bool DisableCss { get; set; }

Property Value

bool

DisableDownlevelRevealedComments

Indicates if disable Downlevel-revealed conditional comments when exporting file to html, the default value is false.

public bool DisableDownlevelRevealedComments { get; set; }

Property Value

bool

EnableCssCustomProperties

Optimize the output of html by using CSS custom properties. For example, for the scenario that there are multiple occurences for one base64 image, with custom property the image data only needs to be saved once so the performance of the resultant html can be improved. The default value is false.

public bool EnableCssCustomProperties { get; set; }

Property Value

bool

EncodeEntityAsCode

Indicates whether the html character entities are replaced with decimal code. (e.g. “&nbsp;” is replaced with “&#160;”). The default value is false.

public bool EncodeEntityAsCode { get; set; }

Property Value

bool

Encoding

If not set,use Encoding.UTF8 as default enconding type.

public Encoding Encoding { get; set; }

Property Value

Encoding

ExcludeUnusedStyles

Indicating whether excludes unused styles. For the generated html files, excluding unused styles can make the file size smaller without affecting the visual effects. So the default value of this property is true. If user needs to keep all styles in the workbook for the generated html(such as the scenario that user needs to restore the workbook from the generated html later), please set this property as false.

public bool ExcludeUnusedStyles { get; set; }

Property Value

bool

ExportActiveWorksheetOnly

Indicates if only exporting the active worksheet to html file. If true then only the active worksheet will be exported to html file; If false then the whole workbook will be exported to html file. The default value is false.

public bool ExportActiveWorksheetOnly { get; set; }

Property Value

bool

ExportArea

Gets or Sets the exporting CellArea of current active Worksheet. If you set this attribute, the print area of current active Worksheet will be omitted. Only the specified area will be exported when saving the file to html.

public CellArea ExportArea { get; set; }

Property Value

CellArea

ExportBogusRowData

Indicating whether exporting bogus bottom row data. The default value is true.If you want to import the html or mht file to excel, please keep the default value.

public bool ExportBogusRowData { get; set; }

Property Value

bool

ExportCellCoordinate

Indicates whether exporting excel coordinate of nonblank cells when saving file to html. The default value is false. If you want to import the output html to excel, please keep the default value.

public bool ExportCellCoordinate { get; set; }

Property Value

bool

ExportCommentsType

Represents type of exporting comments to html files.

public PrintCommentsType ExportCommentsType { get; set; }

Property Value

PrintCommentsType

ExportDataOptions

Indicating the rule of exporting html file data.The default value is All.

public HtmlExportDataOptions ExportDataOptions { get; set; }

Property Value

HtmlExportDataOptions

ExportDocumentProperties

Indicating whether exporting document properties.The default value is true.If you want to import the html or mht file to excel, please keep the default value.

public bool ExportDocumentProperties { get; set; }

Property Value

bool

ExportExtraHeadings

Indicates whether exporting extra headings when the length of text is longer than max display column. The default value is false. If you want to import the html file to excel, please keep the default value.

public bool ExportExtraHeadings { get; set; }

Property Value

bool

ExportFormula

Indicates whether exporting formula when saving file to html. The default value is true. If you want to import the output html to excel, please keep the default value.

public bool ExportFormula { get; set; }

Property Value

bool

ExportFrameScriptsAndProperties

Indicating whether exporting frame scripts and document properties. The default value is true.If you want to import the html or mht file to excel, please keep the default value.

public bool ExportFrameScriptsAndProperties { get; set; }

Property Value

bool

ExportGridLines

Indicating whether exporting the gridlines.The default value is false.

public bool ExportGridLines { get; set; }

Property Value

bool

ExportHiddenWorksheet

Indicating if exporting the hidden worksheet content.The default value is true.

public bool ExportHiddenWorksheet { get; set; }

Property Value

bool

ExportImagesAsBase64

Specifies whether images are saved in Base64 format to HTML, MHTML or EPUB.

public bool ExportImagesAsBase64 { get; set; }

Property Value

bool

Remarks

When this property is set to true image data is exported directly on the img elements and separate files are not created.

ExportPageFooters

Indicates whether exporting page headers.

public bool ExportPageFooters { get; set; }

Property Value

bool

Remarks

Only works when Aspose.Cells.HtmlSaveOptions.SaveAsSingleFile is True.

ExportPageHeaders

Indicates whether exporting page headers.

public bool ExportPageHeaders { get; set; }

Property Value

bool

Remarks

Only works when Aspose.Cells.HtmlSaveOptions.SaveAsSingleFile is True.

ExportPrintAreaOnly

Indicates if only exporting the print area to html file. The default value is false.

public bool ExportPrintAreaOnly { get; set; }

Property Value

bool

ExportRowColumnHeadings

Indicates whether exports sheet’s row and column headings when saving to HTML files.

public bool ExportRowColumnHeadings { get; set; }

Property Value

bool

Remarks

The default value is false.

ExportSimilarBorderStyle

Indicating whether exporting the similar border style when the border style is not supported by browsers. If you want to import the html or mht file to excel, please keep the default value. The default value is false.

public bool ExportSimilarBorderStyle { get; set; }

Property Value

bool

ExportSingleTab

Indicates whether exporting the single tab when the file only has one worksheet. The default value is false.

public bool ExportSingleTab { get; set; }

Property Value

bool

ExportWorkbookProperties

Indicating whether exporting workbook properties.The default value is true.If you want to import the html or mht file to excel, please keep the default value.

public bool ExportWorkbookProperties { get; set; }

Property Value

bool

ExportWorksheetCSSSeparately

Indicating whether export the worksheet css separately.The default value is false.

public bool ExportWorksheetCSSSeparately { get; set; }

Property Value

bool

ExportWorksheetProperties

Indicating whether exporting worksheet properties.The default value is true.If you want to import the html or mht file to excel, please keep the default value.

public bool ExportWorksheetProperties { get; set; }

Property Value

bool

FilePathProvider

Gets or sets the IFilePathProvider for exporting Worksheet to html separately.

public IFilePathProvider FilePathProvider { get; set; }

Property Value

IFilePathProvider

FormatDataIgnoreColumnWidth

Indicating whether show the whole formatted data of cell when overflowing the column. If true then ignore the column width and the whole data of cell will be exported. If false then the data will be exported same as Excel. The default value is false.

public bool FormatDataIgnoreColumnWidth { get; set; }

Property Value

bool

HiddenColDisplayType

Hidden column(the width of this column is 0) in excel,before save this into html format, if HtmlHiddenColDisplayType is “Remove”,the hidden column would not been output, if the value is “Hidden”, the column would been output,but was hidden,the default value is “Hidden”

public HtmlHiddenColDisplayType HiddenColDisplayType { get; set; }

Property Value

HtmlHiddenColDisplayType

HiddenRowDisplayType

Hidden row(the height of this row is 0) in excel,before save this into html format, if HtmlHiddenRowDisplayType is “Remove”,the hidden row would not been output, if the value is “Hidden”, the row would been output,but was hidden,the default value is “Hidden”

public HtmlHiddenRowDisplayType HiddenRowDisplayType { get; set; }

Property Value

HtmlHiddenRowDisplayType

HideOverflowWrappedText

Indicates whether to hide overflow text when the cell format is set to wrap text. The default value is false

public bool HideOverflowWrappedText { get; set; }

Property Value

bool

HtmlCrossStringType

Indicates if a cross-cell string will be displayed in the same way as MS Excel when saving an Excel file in html format. By default the value is Default, so, for cross-cell strings, there is little difference between the html files created by Aspose.Cells and MS Excel. But the performance for creating large html files,setting the value to Cross would be several times faster than setting it to Default or Fit2Cell.

public HtmlCrossType HtmlCrossStringType { get; set; }

Property Value

HtmlCrossType

HtmlVersion

Specifies version of HTML standard that should be used when saving the HTML format. Default value is HtmlVersion.Default.

public HtmlVersion HtmlVersion { get; set; }

Property Value

HtmlVersion

IgnoreInvisibleShapes

Indicate whether exporting those not visible shapes

public bool IgnoreInvisibleShapes { get; set; }

Property Value

bool

Remarks

The default values is false.

ImageOptions

Get the ImageOrPrintOptions object before exporting

public ImageOrPrintOptions ImageOptions { get; }

Property Value

ImageOrPrintOptions

ImageScalable

Indicates whether using scalable unit to describe the image width when using scalable unit to describe the column width. The default value is true.

public bool ImageScalable { get; set; }

Property Value

bool

IsBorderCollapsed

Indicates whether the table borders are collapsed. The default value is true.

public bool IsBorderCollapsed { get; set; }

Property Value

bool

IsExpImageToTempDir

Indicates whether exporting image files to temp directory. Only for saving to html stream.

public bool IsExpImageToTempDir { get; set; }

Property Value

bool

IsExportComments

Indicates if exporting comments when saving file to html, the default value is false.

public bool IsExportComments { get; set; }

Property Value

bool

IsFullPathLink

Indicating whether using full path link in sheet00x.htm,filelist.xml and tabstrip.htm. The default value is false.

public bool IsFullPathLink { get; set; }

Property Value

bool

IsIECompatible

Indicating whether the output HTML is compatible with IE browser. The defalut value is false

public bool IsIECompatible { get; set; }

Property Value

bool

IsJsBrowserCompatible

Indicates whether JavaScript is compatible with browsers that do not support JavaScript. The default value is true.

public bool IsJsBrowserCompatible { get; set; }

Property Value

bool

IsMobileCompatible

Indicates whether the output HTML is compatible with mobile devices. The default value is false.

public bool IsMobileCompatible { get; set; }

Property Value

bool

LinkTargetType

Indicating the type of target attribute in <a> link. The default value is HtmlLinkTargetType.Parent.

public HtmlLinkTargetType LinkTargetType { get; set; }

Property Value

HtmlLinkTargetType

MergeEmptyTdForcely

Indicates whether merging empty TD element forcedly when exporting file to html. The size of html file will be reduced significantly after setting value to true. The default value is false. If you want to import the html file to excel or export perfect grid lines when saving file to html, please keep the default value.

[Obsolete("Use HtmlSaveOptions.MergeEmptyTdType instead.")]
public bool MergeEmptyTdForcely { get; set; }

Property Value

bool

MergeEmptyTdType

The option to merge contiguous empty cells(empty td elements) The default value is MergeEmptyTdType.Default.

public MergeEmptyTdType MergeEmptyTdType { get; set; }

Property Value

MergeEmptyTdType

OfficeMathOutputMode

Indicates how export OfficeMath objects to HTML, Default value is Image.

public HtmlOfficeMathOutputType OfficeMathOutputMode { get; set; }

Property Value

HtmlOfficeMathOutputType

PageTitle

The title of the html page. Only for saving to html stream.

public string PageTitle { get; set; }

Property Value

string

ParseHtmlTagInCell

Indicates whether html tag(such as <div></div>) in cell should be parsed as cell value or preserved as it is. The default value is true.

public bool ParseHtmlTagInCell { get; set; }

Property Value

bool

PresentationPreference

Indicating if html or mht file is presentation preference. The default value is false. if you want to get more beautiful presentation,please set the value to true.

public bool PresentationPreference { get; set; }

Property Value

bool

SaveAsSingleFile

Indicates whether save the html as single file. The default value is false.

public bool SaveAsSingleFile { get; set; }

Property Value

bool

Remarks

If there are multiple worksheets or other required resources such as pictures in the workbook, commonly those worksheets and other resources need to be saved into separate files. For some scenarios, user maybe need to get only one resultant file such as for the convenience of transferring. If so, user may set this property as true.

ShowAllSheets

Indicates whether showing all sheets when saving as a single html file.

public bool ShowAllSheets { get; set; }

Property Value

bool

Remarks

Only works when Aspose.Cells.HtmlSaveOptions.SaveAsSingleFile is True.

StreamProvider

Gets or sets the IStreamProvider for exporting objects.

public IStreamProvider StreamProvider { get; set; }

Property Value

IStreamProvider

TableCssId

Gets and sets the prefix of the type css name such as tr,col,td and so on, they are contained in the table element which has the specific TableCssId attribute. The default value is “”.

public string TableCssId { get; set; }

Property Value

string

WidthScalable

Indicates whether exporting column width in unit of scale to html. The default value is false.

public bool WidthScalable { get; set; }

Property Value

bool

WorksheetScalable

Indicates if zooming in or out the html via worksheet zoom level when saving file to html, the default value is false.

public bool WorksheetScalable { get; set; }

Property Value

bool