问题是您永远不会测试单元格是否为空!
if (cell == null){ System.out.println("Cell is Empty in Column:" + cols);} else if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING){ //pre}通常,在处理
Cell.getCellType()函数时应格外小心,因为空单元格可以是
null或
CELL_TYPE_BLANK。

问题是您永远不会测试单元格是否为空!
if (cell == null){ System.out.println("Cell is Empty in Column:" + cols);} else if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING){ //pre}通常,在处理
Cell.getCellType()函数时应格外小心,因为空单元格可以是
null或
CELL_TYPE_BLANK。