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