Java POI: How to find an Excel cell with a string value and get its position (row) to use that position to find another cell

前端 未结 2 1392
陌清茗
陌清茗 2021-01-11 14:56

I\'m looking for a cell in a spreadsheet that has the string \'Total\' and then use the row in which that cell is to find the total value in another cell which is always the

2条回答
  •  萌比男神i
    2021-01-11 15:40

    You have a semicolon after your if statement which means your if won't work:

    if(cell.getRichStringCellValue().getString () == cellContent);{
    

    Even if this won't resolve your problem, I think your while statement may not be proper for here;

    while(cell.getCellType() == Cell.CELL_TYPE_STRING)
    

    As far as I remember, there are other Cell types in POI. Try to put a breakpoint on these lines and check them if they have correct CellType.

提交回复
热议问题