如何从定义的名称(命名范围)读取值?
我正在使用exceldataReader读取XLS文件,而且工作正常,但我不知道如何读取定义的名称。
我能够将文件内容读取到数据集中:
var excelDataSet = reader.AsDataSet(new ExcelDataSetConfiguration
{
ConfigureDataTable = (_) => new ExcelDataTableConfiguration { UseHeaderRow = true }
});
然后,我可以从内容中获取第一个表:
DataTable? table = excelDataSet.Tables["MyTable"];
然后我可以通过行和列循环,
string cellValue = table.Rows[rowNumber][colNumber].ToString();
但这并不能从所谓的定义的名称< /strong>(命名范围)。如何阅读这些?
I'm using ExcelDataReader to read XLS files and it's working fine but I don't know how to read Defined Names.
I am able to read file contents into a DataSet:
var excelDataSet = reader.AsDataSet(new ExcelDataSetConfiguration
{
ConfigureDataTable = (_) => new ExcelDataTableConfiguration { UseHeaderRow = true }
});
I then take the first table from the contents:
DataTable? table = excelDataSet.Tables["MyTable"];
And I can then loop through rows and columns with
string cellValue = table.Rows[rowNumber][colNumber].ToString();
But this doesn't give me values from the so-called Defined Names (Named Ranges). How to read those?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目前,它在Exceldatareader中不支持 -
请参阅上一个堆栈溢出问题:使用exceldatareader.dataset的指定范围从excel表
It's currently not supported in ExcelDataReader -
See previous stack overflow question: How get a named range from an excel sheet using ExcelDataReader.Dataset