Microsoft Excel is taken as the ideal tool to display and calculate data. When displaying data, users would like to set format to beautify appearance, for example, font style, background color, borders etc.
However, if we want to present the data information as a table in webpage not Excel, how to do? Some people may choose to write HTML code manually to display. But if there is lots of data, the code will be complicated. So in order to meet this requirement more easily and quickly, people think of another method, to convert Excel to HTML. We can import data to Excel and format it at first and then convert it to HTML. If so, we can find that the well formatted data information can be shown as a table in webpage.
Following, I will introduce an easy method to convert Excel to HTML by using C#, VB.NET.
In my example, I use a .NET Excel component, Spire.XLS for .NET. Through it, we can invoke sheet.SaveToHTML(filename string) method directly to save the Excel file to HTML.
static void Main(string args)
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets;
Friend Class Program
Shared Sub Main(ByVal args() As String)
Dim workbook As New Workbook()
Dim sheet As Worksheet = workbook.Worksheets(0)