NativeExcel for .Net Developer's Reference

IWorkbook.SaveAsHTMLMethod

Saves workbook in HTML file. Returns 1 if it succeeds

[Visual Basic]
FunctionSaveAsHTML(_
ByValFilenameAsString_
)AsInteger
[C#]
intSaveAsHTML(
stringFilename
);
[C++]
intSaveAsHTML(
String*Filename
);
[JScript]
functionSaveAsHTML(
StringFilename
):int;

Parameters

Filename
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 and then saves it in the HTML file.

[C#]
  //Create a new empty workbook. 
  IWorkbook book = NativeExcel.Factory.CreateWorkbook(); 
  //Create a new sheet in the workbook. 
  IWorksheet sheet = book.Worksheets.Add(); 
  //cell B2
  IRange cell = sheet.Cells[2,2];
  cell.Value = "Text value";
  cell.Font.Size = 20;
  cell.Font.ColorIndex = 3;
  cell.ColumnWidth = 50;
  //Save workbook
  book.SaveAsHTML("book.html");                
[VisualBasic]
  'Create a new empty workbook. 
  Dim book As IWorkbook = NativeExcel.Factory.CreateWorkbook() 
  'Create a new sheet in the workbook. 
  Dim sheet As IWorksheet = book.Worksheets.Add()
  'cell B2
  Dim cell As IRange = sheet.Cells(2,2)
  cell.Value = "Text value"
  cell.Font.Size = 20
  cell.Font.ColorIndex = 3
  cell.ColumnWidth = 50
  'Save workbook
  book.SaveAsHTML("book.html")                
[C++]
  IWorkbook* book = NativeExcel::Factory::CreateWorkbook(); 
  //Create a new sheet in the workbook. 
  IWorksheet* sheet = book->Worksheets->Add(); 
  //cell B2
  IRange* cell = sheet->Cells->Item[2,2];
  cell->Value = S"Text value";
  cell->Font->Size = 20;
  cell->Font->ColorIndex = 3;
  cell->ColumnWidth = 50;
  //Save workbook
  book->SaveAsHTML(S"book.html");                

See Also

IWorkbook Interface | NativeExcel Namespace