登录 注册
当前位置:主页 > 资源下载 > 50 > ExcelDataReader开源的读取Excel文件组件net35.7z下载

ExcelDataReader开源的读取Excel文件组件net35.7z下载

  • 更新:2024-09-12 08:17:08
  • 大小:158KB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:互联网 - 行业
  • 格式:7Z

资源介绍

开源的读取Excel文件组件,轻量级解析DLL,net3.5 无需自己再编译,直接导入引用: 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();