Bug 23954

Summary: HSSFRow.getLastCellNum() returns value for current row?
Product: POI Reporter: Gary Strackbein <gls03>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED INVALID    
Severity: normal CC: gls03
Priority: P3    
Version: 2.0-pre3   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Gary Strackbein 2003-10-20 19:32:18 UTC
It seems that HSSFRow.getLastCellNum() returns the number of the last non-empty 
cell in the LONGEST row of the sheet, not in the CURRENT row of the sheet.  Is 
this the intent?  If so, it seems like it should be a method in HSSFSheet.  
Having it in HSSFRow implies (to me) that it is the number of the last non-
empty cell in the current row.
Eg., if the last cell in row 0 containing a value is the fifth cell and the 
last cell in row 1 containing a value is the sixth cell, the following code 
returns a value of 6 for count:

HSSFRow row = sheet.getRow(0);
int count = row.getLastCellNum();

Seems to me it should return 5.  The javadocs for this method say it returns 
the number of the last cell contained in THIS row.
Comment 1 Gary Strackbein 2004-02-02 18:12:39 UTC
Can someone confirm for me whether my interpretation is correct, that 
HSSFRow.getLastCellNum() returns the number of the last non-empty 
cell in the LONGEST row of the sheet, not in the CURRENT row of the sheet?  
And, if so, whether it will stay that way?

Thanks.
Gary
Comment 2 Jason Height 2006-09-11 11:33:15 UTC
Nope, it returns the information for the current row BUT the javadoc has not
been 100% correct for a long time. It returns the last cell numbver + 1.



Jason