Reputation: 37
I am trying to format the cell to have two digits after the dot. But something is not working for me
row.getCell(updatedMDColumnIndex, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).setCellValue(countValue);
CellStyle style = row.getSheet().getWorkbook().createCellStyle();
style.setDataFormat(row.getSheet().getWorkbook().createDataFormat().getFormat("0.00"));
row.setRowStyle(style);
Upvotes: 0
Views: 1142
Reputation: 76
I think it is because you are trying to apply a CellStyle into a Row. Consider applying the style into a Cell object as in:
Cell cell = ...// get the Cell you want.
cell.setCellStyle(style); // The style is the CellStyle you created.
Upvotes: 3