我应该使用什么名称空间在.net中使用Row方法

时间:2019-02-01 06:16:20

标签: c# excel

找不到行的命名空间

我一直在尝试读取特定列的单元格并比较该单元格的数据(如果它与字符串匹配)

private static int findRow(HSSFSheet sheet, String cellContent)
{
    int rowNum = 0; 
    for(Row row : sheet) 
    {
        for(Cell cell : row)
        {
            while(cell.getCellType() == Cell.CELL_TYPE_STRING)
            {
                if(cell.getRichStringCellValue().getString () == cellContent)
                {
                        rowNum = row.getRowNum();
                        return rowNum;  
                }
            }
        }
    }               
    return rowNum;
}  

0 个答案:

没有答案