C # ASP. NET uses open source free class library operations Excel

Source: Internet
Author: User

The following class libraries are mainly found:

    1. Myxls (http://sourceforge.net/projects/myxls/)
    2. Koogra (http://sourceforge.net/projects/koogra/)
    3. Excellibrary (http://code.google.com/p/excellibrary/)
    4. Excelpackage (http://excelpackage.codeplex.com/)
    5. Epplus (http://epplus.codeplex.com/)
    6. Linqtoexcel (http://code.google.com/p/linqtoexcel/)
    7. 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

    1. 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>                

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.