Excel中的空白单元格不能给出Cell = Null

我想摆脱我的Excel电子表格中的空白行与Java,但是当我试图得到

cell = lastRow.getCell(c,Row.RETURN_BLANK_AS_NULL); 

对于一个空白单元格,它不会给我单元格为空。 这是我的代码:

  boolean stop = false; boolean nonBlankRowFound; int c; HSSFRow lastRow = null; HSSFCell cell1 = null; while (stop == false) { nonBlankRowFound = false; lastRow = sheet.getRow(sheet.getLastRowNum()); for (c = lastRow.getFirstCellNum(); c <= lastRow.getLastCellNum(); c++) { cell1 = lastRow.getCell(c); if (cell1 != null && lastRow.getCell(c).getCellType() != HSSFCell.CELL_TYPE_BLANK) { nonBlankRowFound = true; } } if (nonBlankRowFound == true) { stop = true; } else { sheet.removeRow(lastRow); } } 

在最后一行中,单元格在excelspreadsheet中为空,但cell1不为空。 有人可以帮忙吗?