https://issues.apache.org/bugzilla/show_bug.cgi?id=57426
Bug ID: 57426 Summary: CellStyle not applying after some columns Product: POI Version: 3.10-FINAL Hardware: PC Status: NEW Severity: major Priority: P2 Component: HSSF Assignee: dev@poi.apache.org Reporter: srinu.y...@gmail.com I have to write data more than 70 columns and 40K rows. After some no of columns CellStyle is not applying for entire column. What i am doing is i am preparing one CellStyle per one column, while writing to data i am applying cellstyle to each cell. My code is as follows. HSSFWorkbook workbook = new HSSFWorkbook(); HSSFWorkbook workbook = new HSSFWorkbook(); Sheet sheet = null; Row row = null; Cell cell = null; CellStyle[] cellStyle = new CellStyle[noofcolumnscount]; cellStyle[colcount] = workbook.createCellStyle(); cellStyle[colcount].setFont(dataFont); if (rptDetailsBean.getColumnDataType() != null && ("NUMBER".equalsIgnoreCase(rptDetailsBean.getColumnDataType()) || "CURRENCY".equalsIgnoreCase(rptDetailsBean.getColumnDataType()))) { cellStyle[colcount].setAlignment(HSSFCellStyle.ALIGN_RIGHT); } else { cellStyle[colcount].setAlignment(HSSFCellStyle.ALIGN_LEFT); } if (rptDetailsBean != null && rptDetailsBean.getFormat() != null) { if (!isFormatValid(rptDetailsBean.getFormat(), rptDetailsBean.getColumnDataType())) { throw new java.lang.Exception("Format at " + (colcount) + "is not valid"); } cellStyle[colcount].setDataFormat(createHelper.createDataFormat().getFormat(rptDetailsBean.getFormat())); } i am applying style while writing each cell while looping trough resultset cell = row.createCell(colcount); int dataLength = 15; if ("DATE".equalsIgnoreCase(rptDetailsBean.getColumnDataType())) { if (rs.getTimestamp(selectClause) != null) { cell.setCellValue(rs.getTimestamp(selectClause)); cell.setCellStyle(cellStyle[colcount]); } else { cell.setCellValue(""); cell.setCellStyle(cellStyle[colcount]); } } else { if ("NUMBER".equalsIgnoreCase(rptDetailsBean.getColumnDataType()) || "CURRENCY".equalsIgnoreCase(rptDetailsBean.getColumnDataType())) { if ((Double) rs.getDouble(selectClause) != null && !rs.wasNull()) { cell.setCellValue(rs.getDouble(selectClause)); cell.setCellStyle(cellStyle[colcount]); } else { cell.setCellValue(""); cell.setCellStyle(cellStyle[colcount]); } } else { if (rs.getString(selectClause) != null) { dataLength = rs.getString(selectClause).length(); cell.setCellValue(rs.getString(selectClause)); cell.setCellStyle(cellStyle[colcount]); } else { cell.setCellValue(""); cell.setCellStyle(cellStyle[colcount]); } } } Can you help in this. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org