How to avoid ApachPoi and Excel from rounding my Double values?

215 Views Asked by At

When extracting data to Excel from my Java code, i got a Double value to export, I'm doing like this :

Cell cell = row.createCell(4);
cell.setCellValue(rowTotal);
cell.setCellStyle(style);

this is working fine but rounding always my values to the top digit and I don't want that.

So I'm using the formatting standard like this :

style.setDataFormat(workbook
                .getCreationHelper()
                .createDataFormat()
                .getFormat("#.##"));

I tried also ##.##, but both values are giving me this this for all the numbers with 2 digits before the coma, like "21,75" or "10,08" and when I go to Excel and just format it like a number it apears !

can you help me please ?

0

There are 0 best solutions below