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);
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.