Convert an Excel file to HTML

Source: Internet
Author: User

background

my work sometimes involves the processing of financial data. As we all know,Excelfiles are popular and widely used in processing data. Excelso we can calculate the data stored in it mathematically. I use it very often in my work. But when the data is displayed, it is used directlyExcelnot particularly good. I want to show it to my users in a different format. HtmlI like it better. So I'm going to use some methods toExcelconverted intoHtml. I found a free application library on the Internet to meet my needs . - Spire.xls.

Introduced

Spire.xlsis a based on. NETcomponent, using it we can createExcelfile, edit existingExceland can be convertedExcelfile. In a word, through it we can easily handleExcel. Let's build a simpleExcelfile to use it.

First, create a workbook instance. Workbooks can show excel file.

Workbook Workbook = New Workbook ();

Then get the first workbook.

Worksheet sheet = workbook. Worksheets[0];

A1 cell set to "

sheet. range["A1"]. Text = "TEST";

Finally, save the file

workbook. SaveToFile ( "Result.xlsx" ,   FileFormat

Use this library to open the Create Excel documents are very convenient. Look at the following generated files:

650) this.width=650; "src=" Http://images.cnitblog.com/blog2015/706090/201503/031529461137329.png "style=" margin:0 px;padding:0px;border:0px; "/>converted intoHtmlformatin the previous section, I taught you how to createExcelfile. In this section, I will show you how to putExcelconverted intoHtml. First, create an electronic workbook instance that will showExcelfile. WorkbookWorkbook =NewWorkbook();

Loading the sample file:

workbook. LoadFromFile ("sample.xlsx");

Convert first page spreadsheet to HTML file

sheet. savetohtml ("result.html");

Original file

650) this.width=650; "src=" Http://images.cnitblog.com/blog2015/706090/201503/031529563636064.png "style=" margin:0 px;padding:0px;border:0px; "/>

generated by Html File

650) this.width=650; "src=" Http://images.cnitblog.com/blog2015/706090/201503/031530070983484.png "style=" margin:0 px;padding:0px;border:0px; "/>

I hope this article will be of some help to you. Thank you.


Convert an Excel file to HTML

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.