I have below piece of code block containing loops:
Row row = null;
Cell cell = null;
String dataVal = null;
String[] temp = null;
for (int j = 0; j < thi
try this...
for (int j = 0; j < this.myDataValues.size(); j++) {
row = sheet.createRow(rownum++);
temp = this.finalRowValues.get(j);
for (int i = 0; i < 4; i++) {
cell = row.createCell(i);
dataVal = temp[i];
if (NumberUtils.isNumber(dataVal)) {
double d = Double.valueOf(dataVal);
cell.setCellValue(d);
cell.setCellType(Cell.CELL_TYPE_NUMERIC);
cell.setCellStyle(styles.get("currency"));
} else if (isValidDate(dataVal)) {
cell.setCellValue(dataVal);
cell.setCellType(Cell.CELL_TYPE_NUMERIC);
cell.setCellStyle(styles.get("date"));
} else {
cell.setCellValue(temp[i]);
cell.setCellType(Cell.CELL_TYPE_STRING);
cell.setCellStyle(styles.get("data"));
}
}
}
for (int i = 0; i < 4; i++) {
sheet.autoSizeColumn(i);
}