David N Horn wrote:

>I have a section of code which reads in a spreadsheet in the standard HSSF
>manner as described on the project web pages.  The cellIterator in use
>causes me problems whenever I encounter blank cells at the beginning of a
>row.  As the iterator searches for physical cells, these blank ones get
>ignored and so the structure of the spreadsheet is affected (in this case,
>the blank cells serve to space a row of "column total" formula cells
>correctly).  Is there a way of forcing the cellIterator to include blank
>cells?  Or would I do better to stipulate a fixed number of columns and use
>a for loop?
>  
>
The cell iterator should return cells that are defined as BLANK. 
 However, it does not return "undefined' cells.
There are many reasons for this.  For one in the physical file, there is 
*nothing* there.  For two, the memory consumption to create the objects 
would be *staggering* for many sheets.  Lastly, the pain it would cause 
someone who wants to find the three populated cells in a row with A-AZ, 
would exceed the benefit to those who need to iterate through them all.

You should account in your logic for the fact that only *defined* cells 
are returned.  Secondly, do note there is no guarantee of order.  

If you need a guarantee of order, and to for instance create a <td/> for 
every *undefined* cell, iterate through the cells, put them in a sorted 
list then iterate through the sorted list, keeping the last value and in 
the event newvalue > lastvalue+1 call to "outputTDs(int numberofTDs)" or 
something to that effect.

>On a similar note, the cellIterator returns the cells in descending order
>for some reason, essentially reading them along the row from right to left.
>Is this normal?  In order to create the correct dataset to later create a
>table object, I am forced to use insertElementAt(value, index 0) which works
>well enough but I do not feel this is very satisfactory.  This also
>contributes to the above problem in some way, as reading from right to left
>any leading blank cells can be safely ignored.
>
There is *no guarantee* of any order.  We're returning what is in the file.

-Andy

>
>Any help will be appreciated.  Thanks.
>
>David
>
>"I like work: it fascinates me.  I could sit and look at it for hours."
>
>                                            - Jerome K Jerome
>                                              "Three Men in a Boat"
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>  
>




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to