The following class libraries are mainly found:
- Myxls (http://sourceforge.net/projects/myxls/)
- Koogra (http://sourceforge.net/projects/koogra/)
- Excellibrary (http://code.google.com/p/excellibrary/)
- Excelpackage (http://excelpackage.codeplex.com/)
- Epplus (http://epplus.codeplex.com/)
- Linqtoexcel (http://code.google.com/p/linqtoexcel/)
- Netoffice (http://netoffice.codeplex.com/) need to install Office Excel
The class library from 1-6 does not need to install Office, does not use Office COM components, and Netoffice needs to install Office, which provides functionality that is similar to Office COM components.
ASP. NET MVC File managementhttp://file.codeplex.com/
Excel2object
Excel and Object convert to each other
Use of Npoi
Https://github.com/tonyqus/npoi
- Epplus (http://epplus.codeplex.com/)
Protected void Uploadbutton_click(ObjectSender, EventArgsE){ If (FileUpload1.HasFile && Path.GetExtension(FileUpload1.FileName) == ". xlsx") { Using (VarExcel= New Excelpackage(FileUpload1.PostedFile.InputStream)) { VarTbl= New DataTable(); VarWs=Excel.Workbook.Worksheets.First(); VarHasheader= True; Adjust accordingly Add DataColumns to DataTable Foreach (VarFirstrowcellInchWs.Cells[1, 1, 1,Ws.Dimension.End.Column])Tbl.Columns.Add(Hasheader?Firstrowcell.Text : String.Format("Column {0}",Firstrowcell.Start.Column)); Add DataRows to DataTable IntStartRow=Hasheader? 2 : 1; For (IntRowNum=StartRow;RowNum<=Ws.Dimension.End.Row;RowNum++) { VarWsrow=Ws.Cells[RowNum, 1,RowNum,Ws.Dimension.End.Column]; DataRowRow=Tbl.NewRow(); Foreach (VarCellInchWsrow)Row[Cell.Start.Column - 1] =Cell.Text;Tbl.Rows.Add(Row); } VarMsg= String.Format("DataTable successfully created from Excel-file. colum-count:{0} row-count:{1} ",Tbl.Columns.Count,Tblrows. Count uploadstatuslabel. Text = Msg;} } else{ uploadstatuslabel. Text = "do not specify a file to upload." }} /span>