c# html to excel,Excel to HTML in C#, VB.NET

This article describes a simple approach to convert Excel to HTML by using C#/VB.NET. We will use as few codes as you can image to convert Excel to HTML in C#/VB.NET, with the perfect quality as you expect. The appearance of data can be improved as you can edit the HTML by applying personal CSS. Thus we believe any effect and requirement you or your clients wished to have.

Spire.XLS for .NETprovides a well-designed class-workbook, which allows us to create new Excel or load an Excel in, and then we can convert Excel to HTML; meanwhile most optimization on the Excel is also allowed during the conversion. Spire.Xls for .NET is always welcome to any kind of trial and evaluation. So now please feel free to download Spire.XLS for .NET and then follow our guide to quickly convert Excel to HTML using C#/VB.NET or try other function of Spire.Xls for .NET.

Now please check my code samples for converting Excel to HTML in C#/VB.NET.

[C#]

using Spire.Xls;

namespace Xls2Html

{

class Program

{

static void Main(string[] args)

{

//load Excel file

Workbook workbook = new Workbook();

workbook.LoadFromFile(@"..\..\test.xls");

//convert Excel to HTML

Worksheet sheet = workbook.Worksheets[0];

sheet.SaveToHtml("sample.html");

//Preview HTML

System.Diagnostics.Process.Start("sample.html");

}

}

}

[VB.NET]

Imports Spire.Xls

Namespace Xls2Html

Class Program

Private Shared Sub Main(args As String())

'load Excel file

Dim workbook As New Workbook()

workbook.LoadFromFile("..\..\test.xls")

'convert Excel to HTML

Dim sheet As Worksheet = workbook.Worksheets(0)

sheet.SaveToHtml("sample.html")

'Preview HTML

System.Diagnostics.Process.Start("sample.html")

End Sub

End Class

End Namespace

Now we can run this application and then a perfect HTML will be presented in your browser. Please see our effective screenshot as below:

ab3eda9698e4cfc4bb5f8d6a612c364b.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值