You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2011/11/21 11:09:10 UTC

DO NOT REPLY [Bug 52220] unable to read blank cells from excel.

https://issues.apache.org/bugzilla/show_bug.cgi?id=52220

Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID
         OS/Version|                            |All

--- Comment #1 from Yegor Kozlov <ye...@dinom.ru> 2011-11-21 10:09:10 UTC ---
As the javadoc states, both Sheet#rowIterator() and Cell#cellIterator() iterate
over the physical data, i.e. they iterate over the rows and cells that are
physically defined in the file. For optimization purposes Excel typically does
not write blank cells and it explains why you are getting only the actual data
cells and not blanks.

For the indexed cell access via Row.getCell(int columnIndex) there is a way to
control the missing cell policy for the case of null and blank cells:


        // return a blank if a cell is null or missing
        workbook.setMissingCellPolicy(Row.RETURN_BLANK_AS_NULL);

        Cell cell = sheet.getRow(0).getCell(0); // never null

Note that MissingCellPolicy works only for indexed access and not for
iterators, that it, no matter what you pass to workbook.setMissingCellPolicy
the cell iterator will always return only physical cells.

Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org