For MS Excel is very powerful on managing data, people would like to use it to display data. We can send with E-mail or print to share an Excel file. But if we want to display data with webpage, how should we do?
Actually, a webpage is based on HTML. Therefore, we can convert Excel to HTML file and display data by using browser.
In this post, I want to introduce the way to convert Excel to HTML with C#. And I use a component, Spire.XLS to realize this function more quickly. So, I have added its dll file as reference in project at the beginning.
The following steps shows details.
- Load file which we want to convert to HTML with workbook.LoadFromFile(). Then, initialize worksheet.
- Save Excel to HTML by using sheet.SaveToHTML()
- Launch the converted HTML file.
static void Main(string args)
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets;
//Save Excel to HTML
Result Shown as Following:
Click Here to LEARN MORE about Spire.XLS
Click Here to DOWNLOAD Spire.XLS