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]