You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by teena21 <fr...@yahoo.com> on 2007/11/01 06:35:49 UTC

Re: how i read blank cells by HSSF

thank you
but it does'nt work my ip workshit data is

aaa	1
bbb	2
ccc	3
	4
ddd	5
eee	6

it gives null point exception at line no. 4
 

Nick Burch wrote:
> 
> On Wed, 31 Oct 2007, teena21 wrote:
>> when i read cells of it if cell is blank then it throws null point 
>> exception
> 
> You should check to see if the cell object is null. There's a difference 
> between no cell record existing, and existing but is blank, which you'll 
> need to be aware of.
> 
> Something more like:
> 
>  	if(cell == null || cell.getCellType == HSSFCell.CELL_TYPE_BLANK) {
>  		System.out.println("Blank cell");
>  	}
> 
> ought to do you
> 
> Nick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-i-read-blank-cells-by-HSSF-tf4724338.html#a13523662
Sent from the POI - User mailing list archive at Nabble.com.


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


Re: how i read blank cells by HSSF

Posted by Nick Burch <ni...@torchbox.com>.
On Wed, 31 Oct 2007, teena21 wrote:
> aaa	1
> bbb	2
> ccc	3
> 	4
> ddd	5
> eee	6
>
> it gives null point exception at line no. 4

You need to check if the row is null first, then fetch the call and check 
if it is null. You can have either of them be null if that area of the 
file has never been written to.

Nick

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