Is this for version 2? Pleas submit a bugzilla report with a sample spreadsheet and of course the code to reproduce.

Thanks.

Anshul Patni wrote:
Hii,
I am also facing the same problem. The problem is: with the following for loop the iterator is not going to the last row


for (HSSFRow row = (HSSFRow) rows.next();

rows.hasNext();

row = (HSSFRow) rows.next()) {
}

I don't know exactly where the problem is. Can someone help??
Regards
pats


Guest <[EMAIL PROTECTED]> wrote:
Hii,

I still have the problem with row iterator...i have a method which gives me the number of rows...it stops when it encountered empty cell > my defined columns

public int getNumberOfRows(HSSFSheet sheet, int numberOfColumns) {
int count = 0;
Iterator rows = (Iterator) sheet.rowIterator();
for (HSSFRow row = (HSSFRow) rows.next();
rows.hasNext();
row = (HSSFRow) rows.next()) {
logger.debug("Row No."+row.getRowNum());
int nullOrBlankCells = 0;
for (int j = 0; j < numberOfColumns; j++) {
HSSFCell cell = row.getCell((short) j);
if(isCellEmpty(cell)){
nullOrBlankCells++;
}
} // iterate over columns finished

// if the row is empty break out of loop
// and return the number of data rows
if (nullOrBlankCells >= numberOfColumns)
break;
count++;
}
return count;
}

private boolean isCellEmpty(HSSFCell cell) {
return (cell == null)
|| (cell.getCellType() == HSSFCell.CELL_TYPE_BLANK)
|| (cell.getCellType() == HSSFCell.CELL_TYPE_STRING
&& cell.getStringCellValue().length() == 0);
}


Why the above doesn't work???


PLEASE HELP
vicky


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------- Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want.

--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to