How to Convert Excel to HTML
Nowadays, most of us choose Microsoft Excel to design, edit and store important data information. MS Excel is perfectly compatible with other financial and data manipulation software. On the other hand, because of internet, HTML files become as popular as other hot file format. To upload information on internet, create and design HTML file is one of the most usual method. This post will show you how to convert Excel to HTML by using C# code.
Tools We Need
- Visual Studio
- Spire.XLS
Tool Introduction
Spire.XLS is a professional Excel component which enables developers/programmers to fast generate, read, write and modify Excel document for .NET and Silverlight.
Download Spire.XLS Here
How to Convert Excel to HTML with Spire.XLS by Using C#
Make sure Spire.XLS and Visual Studio are correctly installed on system. Follow the simple guide below to convert Excel to HTML.
Step 1 Create Project
Create a C# project in Visual Studio and Add Spire.Pdf.dll as reference. The default setting of Spire.Pdf.dll is placed under "C:\Program Files\e-iceblue\Spire.Pdf\Bin”. Select assembly Spire.Pdf.dll and click OK to add it to the project.
using Spire.Xls;
namespace columnchart
{
class Program
{
static void Main(string[] args)
{
}
}
}
Step 2 C# Excel to HTML
Spire.XLS presents an easy solution to convert Excel to HTML. First, load Excel file from local PC. Then, use Spire.XLS to save the Excel file as HTML format. Spire.XLS will remain all the styles from the original Excel files.
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xls");
Worksheet sheet = workbook.Worksheets[0];
sheet.SaveToHtml("sample.html");
Step 3 Launch Project
Press F5 to start the project and then an HTML file will generated in the project folder, bin->debug.
Effective Screenshot:
Tools We Need
- Visual Studio
- Spire.XLS
Tool Introduction
Spire.XLS is a professional Excel component which enables developers/programmers to fast generate, read, write and modify Excel document for .NET and Silverlight.
Download Spire.XLS Here
How to Convert Excel to HTML with Spire.XLS by Using C#
Make sure Spire.XLS and Visual Studio are correctly installed on system. Follow the simple guide below to convert Excel to HTML.
Step 1 Create Project
Create a C# project in Visual Studio and Add Spire.Pdf.dll as reference. The default setting of Spire.Pdf.dll is placed under "C:\Program Files\e-iceblue\Spire.Pdf\Bin”. Select assembly Spire.Pdf.dll and click OK to add it to the project.
using Spire.Xls;
namespace columnchart
{
class Program
{
static void Main(string[] args)
{
}
}
}
Step 2 C# Excel to HTML
Spire.XLS presents an easy solution to convert Excel to HTML. First, load Excel file from local PC. Then, use Spire.XLS to save the Excel file as HTML format. Spire.XLS will remain all the styles from the original Excel files.
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xls");
Worksheet sheet = workbook.Worksheets[0];
sheet.SaveToHtml("sample.html");
Step 3 Launch Project
Press F5 to start the project and then an HTML file will generated in the project folder, bin->debug.
Effective Screenshot:
More about Spire.XLS
Spire.XLS is a professional Excel component which enables developers/programmers to fast generate, read, write and modify Excel document for .NET and Silverlight. It supports C#, VB.NET, ASP.NET, ASP.NET MVC and Silverlight. Click to learn more...
Spire.XLS is a professional Excel component which enables developers/programmers to fast generate, read, write and modify Excel document for .NET and Silverlight. It supports C#, VB.NET, ASP.NET, ASP.NET MVC and Silverlight. Click to learn more...