I'm using Apache POI HSSF to create an Stand out spreadsheet from the Java Web application.
I want a cell formatted as "Number" with 2 decimal points. (My values in Java are BigDecimals, however i can convert these to doubles, not a problem.) I'm by using this code:
CellStyle numericStyle = wb.createCellStyle(); numericStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); // output in this new style... row.createCell(cellnum).setCellValue(((BigDecimal)value).doubleValue()); row.getCell(cellnum).setCellStyle(numericStyle);
The problem is the fact that, despite the fact that this works, Stand out still shows my cells as General. They should be proven as Number. Consequently, for instance, is proven as , but it ought to be .00, which may happen when the format was correct (Number).
I observe that it will get produced as General because I'm able to right-click a cell after which choose "Format Cells" to determine what it's at this time.
Thank you for any help. It must be set to "Number" by Apache POI HSSF. Any advice appreciated.