GemBox Software - .NET Components for Reading/Writing Excel files and Compound Document files  
Search gemboxsoftware.com:    
    
 
 
 
 
  FAQ
  Bugs & Features
  Articles



How to export Excel files to HTML from your .NET applications?

Following example shows how to export Excel files to HTML by using only GemBox.Spreadsheet .NET component.

GemBox.Spreadsheet is a .NET component which provides easy and high performance way to write, read or convert native Microsoft Excel files (XLS, CSV or XLSX) and HTML files without the need for Microsoft Excel on either the developer or client machines. GemBox.Spreadsheet Free comes free of charge while GemBox.Spreadsheet Professional is a commercial version (licensed per developer). Find more information about GemBox.Spreadsheet features or reasons why our component is better then Excel Automation.

Example loads Excel file (in XLS format) and saves the file as HTML:

C# code:

ExcelFile ef = new ExcelFile();

// Loads Excel file (in XLS format).
ef.LoadXls("fileName.xls");

// Saves the file to HTML.
// Note that you can export any part of the file by using ExportToHtml method.
// It can be completely custom if you use HtmlExporterOptions.
ef.SaveHtml("newFile.html", null, true);


Visual Basic .NET code:

Dim ef As New ExcelFile

' Loads Excel file (in XLS format).
ef.LoadXls("fileName.xls")

' Saves the file to HTML.
' Note that you can export any part of the file by using ExportToHtml method.
' It can be completely custom if you use HtmlExporterOptions.
ef.SaveHtml("newFile.html", Nothing, True)


To load the file from another format you only need to replace the LoadXls method with preferred one (LoadXlsx or LoadCsv).
Exporting files to HTML is generic (by using HtmlExporterOptions).



















© GemBox Software. All rights reserved.