You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "Stéphane VANDENBOGAERDE /vst .Y" <st...@mikrosimage.fr> on 2008/01/22 14:00:04 UTC

HFFSCell : null / blank

Hello,

What is the difference between a null cell and a blank cell ?

I have a HHSFRow named row_outBack, and I want examine each cell of this
row with this for :

for (int numcell = 0; numcell < row_outBack.getPhysicalNumberOfCells();
numcell++)
{
	HSSFCell cell_out = row_out.getCell((short) numcell);
	...
}

Sometimes, in the for body, I get null cell_out.
How is it possible ?
Note the number of cells is got with getPhysicalNumberOfCells()...

Thanks.


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


Re: HFFSCell : null / blank

Posted by "Stéphane VANDENBOGAERDE /vst .Y" <st...@mikrosimage.fr>.
"POI Users List" <us...@poi.apache.org> écrit :
>On Tue, 22 Jan 2008, Stéphane  VANDENBOGAERDE /vst .Y wrote:
>> So I can conclude that my array in interpreted as :
>>
>>    col0    |    col1    |    col2    |    col3    |    col4    |    col5
>>
>> ---------------------------------------------------------------------
>>    foo0       foo1       BLANK     foo3      BLANK    BLANK
>>
>> But so I shouldn't get null cells...
>
>I wouldn't expect any, no. Could you open a bug on bugzilla, and upload 
>your excel file + the code you're executing? Without that, I can't 
>figure out what's going wrong :/

I can't remember where it was in my code, but I'll probably come back
there anyway.
I'll then open a bug issue. :-)

Thanks !


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


Re: HFFSCell : null / blank

Posted by Nick Burch <ni...@torchbox.com>.
On Tue, 22 Jan 2008, Stéphane  VANDENBOGAERDE /vst .Y wrote:
> So I can conclude that my array in interpreted as :
>
>    col0    |    col1    |    col2    |    col3    |    col4    |    col5
>
> ---------------------------------------------------------------------
>    foo0       foo1       BLANK     foo3      BLANK    BLANK
>
> But so I shouldn't get null cells...

I wouldn't expect any, no. Could you open a bug on bugzilla, and upload 
your excel file + the code you're executing? Without that, I can't 
figure out what's going wrong :/

Nick

Re: HFFSCell : null / blank

Posted by "Stéphane VANDENBOGAERDE /vst .Y" <st...@mikrosimage.fr>.
"POI Users List" <us...@poi.apache.org> écrit :
>
>Consider the following row:
>
>   col 1    |   col 2   |   col 3    |  col 4  |  col 5  |  col 6 
>-----------------------------------------------------------------
>Foo        |           |    22      | (blank) |         |  33
>
>getPhysicalNumberOfCells() returns 4
>getFirstCol() returns 0
>getLastCol() returns 5
>
>getCell((short)1) returns null
>getCell((short)4) returns null

Thanks for this explanation.

But here what behaviour I get :

In Excel, I have :

    col0    |    col1    |    col2    |    col3    |    col4    |    col5 
  
---------------------------------------------------------------------
    foo0       foo1                        foo3


getPhysicalNumberOfCells() returns me 6.

So I can conclude that my array in interpreted as :

    col0    |    col1    |    col2    |    col3    |    col4    |    col5 
  
---------------------------------------------------------------------
    foo0       foo1       BLANK     foo3      BLANK    BLANK

But so I shouldn't get null cells...


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


Re: HFFSCell : null / blank

Posted by Nick Burch <ni...@torchbox.com>.
On Tue, 22 Jan 2008, Stéphane  VANDENBOGAERDE /vst .Y wrote:
> If you come back to my initial message, I explain I scan all the 
> physical cells with getPhysicalNumberOfCells(), and inside, I try to get 
> back the cell. And sometimes, the result is null... So I don't 
> understand.

Consider the following row:

   col 1    |   col 2   |   col 3    |  col 4  |  col 5  |  col 6 
-----------------------------------------------------------------
Foo        |           |    22      | (blank) |         |  33

getPhysicalNumberOfCells() returns 4
getFirstCol() returns 0
getLastCol() returns 5

getCell((short)1) returns null
getCell((short)4) returns null

Nick

Re: HFFSCell : null / blank

Posted by "Stéphane VANDENBOGAERDE /vst .Y" <st...@mikrosimage.fr>.
"POI Users List" <us...@poi.apache.org> écrit :

>> If so, why does getPhysicalNumberOfCells() count them ?
>
>It doesn't. It only counts the non-null cells, which does include the 
>blank ones

If you come back to my initial message, I explain I scan all the physical
cells with getPhysicalNumberOfCells(), and inside, I try to get back the
cell. And sometimes, the result is null... So I don't understand.


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


Re: HFFSCell : null / blank

Posted by Nick Burch <ni...@torchbox.com>.
On Tue, 22 Jan 2008, Stéphane  VANDENBOGAERDE /vst .Y wrote:
> "POI Users List" <us...@poi.apache.org> écrit :
>> On Tue, 22 Jan 2008, Stéphane  VANDENBOGAERDE /vst .Y wrote:
>>> What is the difference between a null cell and a blank cell ?
>>
>> if row.getCell(num) returns null, there has never been data there
>
> If so, why does getPhysicalNumberOfCells() count them ?

It doesn't. It only counts the non-null cells, which does include the 
blank ones

Nick

Re: HFFSCell : null / blank

Posted by "Stéphane VANDENBOGAERDE /vst .Y" <st...@mikrosimage.fr>.
"POI Users List" <us...@poi.apache.org> écrit :
>On Tue, 22 Jan 2008, Stéphane  VANDENBOGAERDE /vst .Y wrote:
>> What is the difference between a null cell and a blank cell ?
>
>if row.getCell(num) returns null, there has never been data there

If so, why does getPhysicalNumberOfCells() count them ?
>
>
>if row.getCell(num) returns a cell of type blank, then the file had data 
>there, the data was removed, but excel is lazy and can't be bothered to 
>remove the cell from the file, so just marks it as being blank
>
>
>With ooxml, they've finally ditched the idea of blank cells (when you 
>empty a cell, it really gets removed from the file), but they're a fun 
>"feature" with the ole2 stuff :/
>
:-|

Anyway, thanks for your answer.


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


Re: HFFSCell : null / blank

Posted by Nick Burch <ni...@torchbox.com>.
On Tue, 22 Jan 2008, Stéphane  VANDENBOGAERDE /vst .Y wrote:
> What is the difference between a null cell and a blank cell ?

if row.getCell(num) returns null, there has never been data there

if row.getCell(num) returns a cell of type blank, then the file had data 
there, the data was removed, but excel is lazy and can't be bothered to 
remove the cell from the file, so just marks it as being blank


With ooxml, they've finally ditched the idea of blank cells (when you 
empty a cell, it really gets removed from the file), but they're a fun 
"feature" with the ole2 stuff :/

Nick