HotXLS Docs

SaveAsHTML method

Saves Workbook in HTML file. Returns 1 if it succeeds.

Remarks

This method is deprecated. Use IXLSWorkbook.SaveAs method.
Hyperlinks in exported worksheet cells are written as HTML anchor tags. The hyperlink address is emitted as href, ScreenTip text is emitted as a title attribute, and all attribute and display text is HTML-escaped.
Cell comments are emitted as escaped title attributes on the exported table cells, so review notes remain available as browser tooltips in the generated HTML.
To customise exporter behaviour, create TXLSHTMLExport directly. Its Options property defaults to [xhHyperlinks, xhComments]; remove xhHyperlinks to write linked cells as plain escaped text, or remove xhComments to suppress comment title output. Set Title to write an escaped HTML document <title> value. Set SimpleExport to write a minimal table without generated CSS classes, hyperlink anchors, or comment title attributes. Use TableBorderWidth, CellPadding, and CellSpacing to control the generated table layout attributes.

Syntax

function SaveAsHTML(FileName: WideString): Integer;
FileName WideString. A string that indicates the name of the file to be saved. You can include a full path; if you don't, Workbook saves the file in the current folder.

Example

This example creates a new Workbook with two Worksheets and then saves the Workbook in HTML file.

Var
  Workbook: IXLSWorkbook;
begin
  Workbook := TXLSWorkbook.Create; {create new Workbook}
  Workbook.Worksheets.Add;
  {....}
  Workbook.Worksheets.Add;
  {....}
  Workbook.SaveAsHTML('C:\book.html');
end;