zoukankan      html  css  js  c++  java
  • Excel Data Reader开源的.NET excel读取库

    下载地址 http://exceldatareader.codeplex.com/

    使用方法:

    FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read);
    
    //1. Reading from a binary Excel file ('97-2003 format; *.xls)
    IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);
    //...
    //2. Reading from a OpenXml Excel file (2007 format; *.xlsx)
    IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
    //...
    //3. DataSet - The result of each spreadsheet will be created in the result.Tables
    DataSet result = excelReader.AsDataSet();
    //...
    //4. DataSet - Create column names from first row
    excelReader.IsFirstRowAsColumnNames = true;
    DataSet result = excelReader.AsDataSet();
    
    //5. Data Reader methods
    while (excelReader.Read())
    {
        //excelReader.GetInt32(0);
    }
    
    //6. Free resources (IExcelDataReader is IDisposable)
    excelReader.Close();
  • 相关阅读:
    DFS,BFS算法
    浙江理工大学7月月赛
    矩阵快速幂
    数塔
    Bone Collector
    畅通工程
    敌兵布阵
    Tempter of the Bone
    Elevator
    Fibonacci Again
  • 原文地址:https://www.cnblogs.com/answercard/p/3002524.html
Copyright © 2011-2022 走看看