I've got a huge stand out file with a lot of posts which appears like this :-

Column1 Column2 Column3 Column4 Column5
abc             def             ghi
        mno             pqr
......

This is actually the code which i authored to print these values:

try {
    FileInputStream inputStr = new FileInputStream(fileName);
    XSSFWorkbook xssfWork = new XSSFWorkbook(inputStr) ;
    XSSFSheet sheet1 = xssfWork.getSheetAt(0);
    Iterator rowItr = sheet1.rowIterator();

    while ( rowItr.hasNext() ) {
        XSSFRow row = (XSSFRow) rowItr.next();
        System.out.println("ROW:-->");
        Iterator cellItr = row.cellIterator();

        while ( cellItr.hasNext() ) {
            XSSFCell cell = (XSSFCell) cellItr.next();
            System.out.println("CELL:-->"+cell.toString());
        }
    }
} catch (Exception e) {
    e.printStackTrace();
}

The output produced with this code is :-

ROW:-->
CELL:-->Column1
CELL:-->Column2
CELL:-->Column3
CELL:-->Column4
CELL:-->Column5
ROW:-->
CELL:-->abc
CELL:-->def
CELL:-->ghi
ROW:-->
CELL:-->mno
CELL:-->pqr

So, When we consider the output above we are able to observe that cells where I left blank values wasn't acquired through the POI library , it is possible to means by that we could possibly get these values as null. or a method to notice that the values presented missed blank cells?

Thanks.

        for(org.apache.poi.ss.usermodel.Row tmp : hssfSheet){
            for(int i = 0; i<8;i++){
                System.out.println(tmp.getCell(i));
            }               
        }

I've been annoyed by this same issue. Here's what I discovered with poi-3.7-20101029.

RowIterator and CellIterator don't support iterating over NULL cells or rows -- only physically defined cells (which may be BLANK).

The answer that returns things i expect requires while using -based Row.getCell([int], Row.CREATE_NULL_AS_BLANK), similar to Chavira's answer alludes to (presuming 8 cell rows). Or make use of the Cell.columnIndex value while iterating to check on for jumping amounts...

Irritatingly, after creating blank cells using method #1, the iterators will return the now produced BLANK cells. I contemplate it a bug that MissingCellPolicy is overlooked by CellIterator.

If you wish to get all cells, whether they exist or otherwise, then your iterator is not for you personally. Rather, you have to by hand fetch the right cells, likely having a missing cell policy

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());
   }
}