poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Burch <n...@torchbox.com>
Subject Re: Blank and null cells
Date Mon, 15 Sep 2008 20:49:37 GMT
On Mon, 15 Sep 2008, Jeffrey A Kenward wrote:
> I'm using the Row iterator from sheet and subsequently the Cell iterator
> from row to read a sheet's data.
>
> But when the addr2 is blank in excel 2007, the iterator comes back as 
> only have 7 values (shifting all the values and messing up my location 
> data basically).

This is entirely as expected. The iterators only by default iterate over 
things which are physically present in the file. The javadocs do explain 
this, eg 
http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFRow.html#cellIterator()

> I've tried setting the workbook MissingCellPolicy to 
> RETURN_NULL_AND_BLANK but that doesn't seem to help.

It won't. As per the javadocs, that only affects fetching cells, not the 
iterator

> Am I doing this wrong?  How is this typically done?

Either check the cell's number when it's returned, or follow most of the 
examples and just use a for loop + getCell(num), which uses the missing 
cell policy

Nick

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


Mime
View raw message