简体   繁体   English

如何从定义的名称(命名范围)中读取值?

[英]How to read values from Defined Names (Named Ranges)?

I'm using ExcelDataReader to read XLS files and it's working fine but I don't know how to read Defined Names.我正在使用 ExcelDataReader 读取 XLS 文件,它工作正常,但我不知道如何读取定义的名称。

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?怎么读那些?

ExcelDataReader 目前不支持它 - 请参阅上一个堆栈溢出问题: How get a named range from an excel sheet using ExcelDataReader.Dataset

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM