You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Andreas Hartmann <an...@apache.org> on 2009/08/12 12:20:00 UTC

Number of rows with HSSF Event API

Hi everyone,

I'm new to POI and started parsing Excel spreadsheets with the HSSF 
event API, which works fine.

But since I'm dealing with rather large files, I'd like to display a 
progress bar to the user while the spreadsheet is parsed.

Is there any way to determine the number of rows before the whole 
document is parsed?

Thanks a lot in advance!

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


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


Re: Number of rows with HSSF Event API

Posted by MSB <ma...@tiscali.co.uk>.
Thanks for letting me know Andreas, as I said, I was assuming that the row
count would not be known until the file was parsed. 

Knowing there is a quick way to get at it is the sort of information may be
of use to others in the future so thanks again for that.

Yours

Mark B


Andreas Hartmann wrote:
> 
> Hi Mark,
> 
> MSB schrieb:
>> Please do not take this answer as being definitive Andreas as I have
>> never
>> used this API before - the event driven API that is. Logically though I
>> cannot see that it would be possible to find out how many rows there are
>> in
>> the workbook as the API is processing it, so to speak, sequentially and
>> cannot know this until it reaches the ened of the the file.
> 
> yes, I was afraid that this would be the case – but I was hoping that 
> maybe the number of rows would be stored somewhere in the beginning of 
> the file.
> 
>> Having said that, I will try to find the time to have a quick dig around
>> and
>> post again if I find an answer.
> 
> Actually I have just solved the problem. I'm executing an additional 
> parser run, only listening for the row records to count them, which is 
> very fast even with multiple thousands of rows.
> 
> Thanks for your reply!
> 
> -- Andreas
> 
> 
>> 
>> Yours
>> 
>> Mark B
>> 
>> 
>> Andreas Hartmann wrote:
>>> Hi everyone,
>>>
>>> I'm new to POI and started parsing Excel spreadsheets with the HSSF 
>>> event API, which works fine.
>>>
>>> But since I'm dealing with rather large files, I'd like to display a 
>>> progress bar to the user while the spreadsheet is parsed.
>>>
>>> Is there any way to determine the number of rows before the whole 
>>> document is parsed?
>>>
>>> Thanks a lot in advance!
>>>
>>> -- Andreas
>>>
>>>
>>> -- 
>>> Andreas Hartmann, CTO
>>> BeCompany GmbH
>>> http://www.becompany.ch
>>> Tel.: +41 (0) 43 818 57 01
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>> For additional commands, e-mail: user-help@poi.apache.org
>>>
>>>
>>>
>> 
> 
> 
> -- 
> Andreas Hartmann, CTO
> BeCompany GmbH
> http://www.becompany.ch
> Tel.: +41 (0) 43 818 57 01
> 
> 
> ---------------------------------------------------------------------
> 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/Number-of-rows-with-HSSF-Event-API-tp24933683p24953155.html
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: Number of rows with HSSF Event API

Posted by Andreas Hartmann <an...@apache.org>.
Hi Mark,

MSB schrieb:
> Please do not take this answer as being definitive Andreas as I have never
> used this API before - the event driven API that is. Logically though I
> cannot see that it would be possible to find out how many rows there are in
> the workbook as the API is processing it, so to speak, sequentially and
> cannot know this until it reaches the ened of the the file.

yes, I was afraid that this would be the case – but I was hoping that 
maybe the number of rows would be stored somewhere in the beginning of 
the file.

> Having said that, I will try to find the time to have a quick dig around and
> post again if I find an answer.

Actually I have just solved the problem. I'm executing an additional 
parser run, only listening for the row records to count them, which is 
very fast even with multiple thousands of rows.

Thanks for your reply!

-- Andreas


> 
> Yours
> 
> Mark B
> 
> 
> Andreas Hartmann wrote:
>> Hi everyone,
>>
>> I'm new to POI and started parsing Excel spreadsheets with the HSSF 
>> event API, which works fine.
>>
>> But since I'm dealing with rather large files, I'd like to display a 
>> progress bar to the user while the spreadsheet is parsed.
>>
>> Is there any way to determine the number of rows before the whole 
>> document is parsed?
>>
>> Thanks a lot in advance!
>>
>> -- Andreas
>>
>>
>> -- 
>> Andreas Hartmann, CTO
>> BeCompany GmbH
>> http://www.becompany.ch
>> Tel.: +41 (0) 43 818 57 01
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>
>>
> 


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


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


Re: Number of rows with HSSF Event API

Posted by MSB <ma...@tiscali.co.uk>.
Please do not take this answer as being definitive Andreas as I have never
used this API before - the event driven API that is. Logically though I
cannot see that it would be possible to find out how many rows there are in
the workbook as the API is processing it, so to speak, sequentially and
cannot know this until it reaches the ened of the the file.

Having said that, I will try to find the time to have a quick dig around and
post again if I find an answer.

Yours

Mark B


Andreas Hartmann wrote:
> 
> Hi everyone,
> 
> I'm new to POI and started parsing Excel spreadsheets with the HSSF 
> event API, which works fine.
> 
> But since I'm dealing with rather large files, I'd like to display a 
> progress bar to the user while the spreadsheet is parsed.
> 
> Is there any way to determine the number of rows before the whole 
> document is parsed?
> 
> Thanks a lot in advance!
> 
> -- Andreas
> 
> 
> -- 
> Andreas Hartmann, CTO
> BeCompany GmbH
> http://www.becompany.ch
> Tel.: +41 (0) 43 818 57 01
> 
> 
> ---------------------------------------------------------------------
> 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/Number-of-rows-with-HSSF-Event-API-tp24933683p24949515.html
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