0

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 ?

Sofiane
  • 473
  • 1
  • 6
  • 13
  • 2
    Where do you think to see any rounding issue here? All I see is that the column width is too small to show the formatted numbers. That's why they are showing `####`. Set a greater column width. – Axel Richter Mar 28 '23 at 15:27
  • @AxelRichter absolutly !! Thank you man – Sofiane Mar 28 '23 at 15:32

0 Answers0