我正在尝试返回一个数据集,该数据集返回第一行作为标题行(这是有效的),并根据其列标题从数据中过滤掉整个列。
ExcelDataReader 3.4.0
介绍了FilterColumn
我尝试使用的回调选项。
下面是我的AsDataSet
电话
var ds = reader.AsDataSet(new ExcelDataSetConfiguration()
{
ConfigureDataTable = (tableReader) => new ExcelDataTableConfiguration()
{
// Gets or sets a value indicating whether to use a row from the
// data as column names.
UseHeaderRow = true,
// Gets or sets a callback to determine which row is the header row.
// Only called when UseHeaderRow = true.
ReadHeaderRow = (rowReader) => {
// F.ex skip the first row and use the 2nd row as column headers:
rowReader.ToString();
},
FilterColumn = (rowReader, columnIndex) => {
return //if header == "string" filter out entire column
}
}
});
上面当我尝试查看行时,列的索引对并测试它是否包含它返回的短语。FilterColumn
在这种情况下,正确的用法是什么?
链接到 github:https ://github.com/ExcelDataReader/ExcelDataReader/tree/v3.4.0