濮阳杆衣贸易有限公司

主頁 > 知識庫 > .NET中讀取Excel文件的數(shù)據(jù)及excelReader應用

.NET中讀取Excel文件的數(shù)據(jù)及excelReader應用

熱門標簽:南陽外呼系統(tǒng)定制化 玉林市機器人外呼系統(tǒng)哪家好 合肥電銷外呼系統(tǒng)哪家公司做的好 同安公安400電話怎么申請流程 申請400電話手續(xù) 電話機器人軟件銷售工作 蘋果手機凱立德地圖標注 預測式外呼系統(tǒng)使用說明 百度ai地圖標注
項目介紹
輕量,快速的C#編寫的庫讀取Microsoft Excel文件('97-2007)。
跨平臺:
- Windows with .Net Framework 2
- Windows Mobile with Compact Framework
- Linux, OS X, BSD with Mono 2+
如何使用
C# 代碼:
復制代碼 代碼如下:

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();

VB.NET 代碼:
復制代碼 代碼如下:

Dim stream As FileStream = File.Open(filePath, FileMode.Open, FileAccess.Read)
'1. Reading from a binary Excel file ('97-2003 format; *.xls)
Dim excelReader As IExcelDataReader = ExcelReaderFactory.CreateBinaryReader(stream)
'...
'2. Reading from a OpenXml Excel file (2007 format; *.xlsx)
Dim excelReader As IExcelDataReader = ExcelReaderFactory.CreateOpenXmlReader(stream)
'...
'3. DataSet - The result of each spreadsheet will be created in the result.Tables
Dim result As DataSet = excelReader.AsDataSet()
'...
'4. DataSet - Create column names from first row
excelReader.IsFirstRowAsColumnNames = True
Dim result As DataSet = excelReader.AsDataSet()
'5. Data Reader methods
While excelReader.Read()
'excelReader.GetInt32(0);
End While
'6. Free resources (IExcelDataReader is IDisposable)
excelReader.Close()
您可能感興趣的文章:
  • ASP.NET(C#)讀取Excel的文件內容
  • .net客戶端導出Excel實現(xiàn)代碼及注意事項
  • .Net中導出數(shù)據(jù)到Excel(asp.net和winform程序中)
  • asp.net生成Excel并導出下載五種實現(xiàn)方法
  • C#數(shù)據(jù)導入/導出Excel文件及winForm導出Execl總結
  • ASP.NET下將Excel表格中的數(shù)據(jù)規(guī)則的導入數(shù)據(jù)庫思路分析及實現(xiàn)
  • ASP.NET導出Excel打開時提示:與文件擴展名指定文件不一致解決方法
  • asp.net Grid 導出Excel實現(xiàn)程序代碼
  • C#實現(xiàn)EXCEL數(shù)據(jù)到TXT文檔的轉換

標簽:南京 海南 揚州 南昌 南京 淄博 嘉興 臺州

巨人網絡通訊聲明:本文標題《.NET中讀取Excel文件的數(shù)據(jù)及excelReader應用》,本文關鍵詞  .NET,中,讀取,Excel,文件,的,;如發(fā)現(xiàn)本文內容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內容系統(tǒng)采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《.NET中讀取Excel文件的數(shù)據(jù)及excelReader應用》相關的同類信息!
  • 本頁收集關于.NET中讀取Excel文件的數(shù)據(jù)及excelReader應用的相關信息資訊供網民參考!
  • 推薦文章
    濮阳县| 乐至县| 土默特左旗| 绥棱县| 仪陇县| 乌苏市| 丹东市| 房产| 崇信县| 平和县| 龙口市| 东平县| 磐石市| 根河市| 大姚县| 江陵县| 靖宇县| 日喀则市| 鄂托克旗| 济阳县| 赞皇县| 南江县| 德兴市| 林西县| 永兴县| 嵩明县| 四子王旗| 白玉县| 肇源县| 方城县| 钟祥市| 栖霞市| 泾阳县| 天柱县| 平乡县| 大港区| 大冶市| 宜宾市| 吴忠市| 中宁县| 敖汉旗|