自动过滤后,C#获取行单元格值不起作用

时间:2017-03-17 10:26:59

标签: c# excel

当过滤的行为数字2时,下面的代码不起作用,这意味着它位于列标题下方,只检索列标题,但除此之外它工作正常。

for (int areaId = 1; areaId <= filteredRange.Areas.Count; areaId++)
{
    Range rowRecord = filteredRange.Areas.Item(areaId);
    object[,] areaValues = rowRecord.Value;
    CustName = rowRecord.Cells[areaId, 1].Value2;
    CustOrder= rowRecord.Cells[areaId, 39].Value2;

    xcelValJobID = (string)areaValues[1, 1];

}

enter image description here

0 个答案:

没有答案