NativeExcel2 for .Net Developer's Reference

IWorksheet.SaveAsHTMLMethod(String)

Saves worksheet 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, worksheet saves the file in the current folder.

Example

This example creates a new workheet 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 worksheet
  sheet.SaveAsHTML("sheet.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 worksheet
  sheet.SaveAsHTML("sheet.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 worksheet
  sheet->SaveAsHTML(S"sheet.html");                

See Also

IWorksheet Interface | NativeExcel Namespace | IWorksheet.SaveAsHTML Overload List