我试图从excel文件的流中读取值,不幸的是,在从ExcelDataReader包中安装了ExcelDataReader.DataSet和NuGet之后,我无法创建IExcelDataReader类。它也不读“进口”。
Imports System.IO
Imports ExcelDataReader
Public Class ExcelMng
Public Function Values_GET(stream As Stream)
Dim reader As IExcelDataReader
End Function
End Class发现错误:
“IExcelDataReader”--它没有定义。
我尝试过的事物:
相关信息:
发布于 2019-12-18 02:28:00
我使用了下面的代码来运行代码,它运行得很好。
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim reader As IExcelDataReader
Dim stream = File.Open("D:\test.xlsx", FileMode.Open, FileAccess.Read)
reader = ExcelDataReader.ExcelReaderFactory.CreateReader(stream)
Dim conf = New ExcelDataSetConfiguration With {
.ConfigureDataTable = Function(__) New ExcelDataTableConfiguration With {
.UseHeaderRow = True
}
}
Dim dataSet = reader.AsDataSet(conf)
Dim dataTable = dataSet.Tables(0)
End Sub我注意到我们需要安装.Net Framework4.5来运行这个程序。

https://stackoverflow.com/questions/59364643
复制相似问题