You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Nhan Vo <nh...@smileconsult.de> on 2011/07/12 11:14:02 UTC
Problem with HSSFSheet.getLastRowNum()
Hi all,
I'm writing an application that reads data from an xls file provided by
the customer, in which I use HSSFSheet.getLastRowNum() to determine the
last row that contains the data. However this occasionally fails with a
null exception, as the last row number is bigger than the actual one by
1 (e.g. it tries to read row 110 although the actual last row is 109).
I normally have to get around this by manually creating a new sheet and
then copying the data to it.
I have also tried adding new rows to the sheet by entering arbitrary
text/numbers to some cells below the last row, and it seems the outcome
of HSSFSheet.getLastRowNum() does not work correctly (it sometimes stays
the same, sometimes gives a number that is not correct). I use
OpenOffice Calc for the editing, by the way.
Could someone please give some advice on this? Thank you!
Best regards,
NV
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Problem with HSSFSheet.getLastRowNum()
Posted by Nhan Vo <nh...@smileconsult.de>.
Download link of the xls file http://www.mediafire.com/?dzl03z4dl8ge2ac
Sorry, first time in a mailing list +_+
On 7/12/2011 2:11 PM, Nhan Vo wrote:
> Hi again,
>
> Sorry there's some mix-up on my part. Adding new rows seems to work
> correctly. It is only incorrect if the number of the modified row is
> smaller than the previous last row number (which itself is wrong).
>
> Please find attached the xls file, with the original sheet and the
> newly created one that contains the copied data.
>
> NV
>
> On 7/12/2011 1:56 PM, Nhan Vo wrote:
>> Yes. POI 3.8 Beta 3 also fails like POI 3.7
>>
>> NV
>>
>> On 7/12/2011 12:53 PM, Nick Burch wrote:
>>> On Tue, 12 Jul 2011, Nhan Vo wrote:
>>>> I have also tried adding new rows to the sheet by entering
>>>> arbitrary text/numbers to some cells below the last row, and it
>>>> seems the outcome of HSSFSheet.getLastRowNum() does not work
>>>> correctly (it sometimes stays the same, sometimes gives a number
>>>> that is not correct). I use OpenOffice Calc for the editing, by the
>>>> way.
>>>
>>> Have you tried with POI 3.8 beta 3?
>>>
>>> Nick
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>> For additional commands, e-mail: user-help@poi.apache.org
>>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
--
Msc. Thanh-Trong-Nhan Vo
smile consult GmbH
Vahrenwalder Strasse 7
D-30165 Hannover
Tel: 0511/9357625 Fax: 0511/9357629
Mail: nhanvo@smileconsult.de
Internet: http://www.smileconsult.de
Geschäftsführer: Frank Sellerhoff - Peter Milbradt - Christoph Lippert
USt-IdNr.: DE208857046 - Amtsgericht Hannover HRB 58707
Re: Problem with HSSFSheet.getLastRowNum()
Posted by Nhan Vo <nh...@smileconsult.de>.
Hi again,
Sorry there's some mix-up on my part. Adding new rows seems to work
correctly. It is only incorrect if the number of the modified row is
smaller than the previous last row number (which itself is wrong).
Please find attached the xls file, with the original sheet and the newly
created one that contains the copied data.
NV
On 7/12/2011 1:56 PM, Nhan Vo wrote:
> Yes. POI 3.8 Beta 3 also fails like POI 3.7
>
> NV
>
> On 7/12/2011 12:53 PM, Nick Burch wrote:
>> On Tue, 12 Jul 2011, Nhan Vo wrote:
>>> I have also tried adding new rows to the sheet by entering arbitrary
>>> text/numbers to some cells below the last row, and it seems the
>>> outcome of HSSFSheet.getLastRowNum() does not work correctly (it
>>> sometimes stays the same, sometimes gives a number that is not
>>> correct). I use OpenOffice Calc for the editing, by the way.
>>
>> Have you tried with POI 3.8 beta 3?
>>
>> Nick
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>
>
--
Msc. Thanh-Trong-Nhan Vo
smile consult GmbH
Vahrenwalder Strasse 7
D-30165 Hannover
Tel: 0511/9357625 Fax: 0511/9357629
Mail: nhanvo@smileconsult.de
Internet: http://www.smileconsult.de
Geschäftsführer: Frank Sellerhoff - Peter Milbradt - Christoph Lippert
USt-IdNr.: DE208857046 - Amtsgericht Hannover HRB 58707
Re: Problem with HSSFSheet.getLastRowNum()
Posted by Nhan Vo <nh...@smileconsult.de>.
Yes. POI 3.8 Beta 3 also fails like POI 3.7
NV
On 7/12/2011 12:53 PM, Nick Burch wrote:
> On Tue, 12 Jul 2011, Nhan Vo wrote:
>> I have also tried adding new rows to the sheet by entering arbitrary
>> text/numbers to some cells below the last row, and it seems the
>> outcome of HSSFSheet.getLastRowNum() does not work correctly (it
>> sometimes stays the same, sometimes gives a number that is not
>> correct). I use OpenOffice Calc for the editing, by the way.
>
> Have you tried with POI 3.8 beta 3?
>
> Nick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
--
Msc. Thanh-Trong-Nhan Vo
smile consult GmbH
Vahrenwalder Strasse 7
D-30165 Hannover
Tel: 0511/9357625 Fax: 0511/9357629
Mail: nhanvo@smileconsult.de
Internet: http://www.smileconsult.de
Geschäftsführer: Frank Sellerhoff - Peter Milbradt - Christoph Lippert
USt-IdNr.: DE208857046 - Amtsgericht Hannover HRB 58707
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Problem with HSSFSheet.getLastRowNum()
Posted by Nick Burch <ni...@alfresco.com>.
On Tue, 12 Jul 2011, Nhan Vo wrote:
> I have also tried adding new rows to the sheet by entering arbitrary
> text/numbers to some cells below the last row, and it seems the outcome
> of HSSFSheet.getLastRowNum() does not work correctly (it sometimes stays
> the same, sometimes gives a number that is not correct). I use
> OpenOffice Calc for the editing, by the way.
Have you tried with POI 3.8 beta 3?
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org