You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2006/10/04 10:48:46 UTC

DO NOT REPLY [Bug 30635] - HSSFRow.getLastCellNum() is out by one

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30635>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30635





------- Additional Comments From cpuidle@gmx.de  2006-10-04 01:48 -------
I wrote a small test program to analyze the issue (see attachment) and found 
the following (unexpected) result:
0) when XLS file has 0 lines, both getFirst- and getLastRowNum return 0. This 
would seem to indicate that for reading them you'd need to loop from 
frist..last-1.
1) when XLS file has 1 lines, both getFirst- and getLastRowNum still return 0. 
This is confusing- as it would seem to indicate that for reading them you'd 
need to loop from frist..last instead of last-1.
2) when XLS file has 2 lines, both getFirstRowNum still returns 0 while 
getLastRowNum return 1. This is consistent with the finding in 1).

These results are the same when test is executed against files produced by poi 
or Excel 2003 either. I did not validate the bahaviour for columns but suspect 
they might be the same.

The only sensible conclusion I can draw is that getLastRowNum on XLS files is 
not a reliable indicator if the last row really exists. Applications need to 
read up to getLastRowNum and verify if row!=null to handle the case of zero 
total rows.
If this is true, then hte bug- if any- might be in the documentation of the 
getLastRowNum function's behaviour?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/