见图:50列,第一列读的成功,读第二列为空,直接把下面列的值前移了。
我想知道为什么会出现HSSFCell对象为空的情况。怎么解决。Iterator<HSSFCell> cit = (Iterator<HSSFCell>) row.cellIterator();
while(cit.hasNext())
{HSSFCell cell = cit.next();if (cell == null) {
break;
}String strValue = parentReader.getCellValue(cell);

解决方案 »

  1.   


    for(Row row : sheet) {
       for(int cn=0; cn<row.getLastCellNum(); cn++) {
           // If the cell is missing from the file, generate a blank one
           Cell cell = row.getCell(cn, MissingCellPolicy.CREATE_NULL_AS_BLANK);
           // Print the cell for debugging
           System.out.println("CELL: " + cn + " --> " + cell.toString());
       }
    }
    替代器貌似有这样的问题。 试试类似上面这种取数据吧。