I need to write a Double value in a numeric cell using a specific format, i mean, the generated xls must have numeric cells containing Double values like, for example: 8,1. I am trying something like:
DecimalFormat dFormat = new DecimalFormat("##.#");
dFormat.format(doubleValue);
But, since format method returns a String, no matter whether I create cells as numeric or not, they always behave as text cells. I was thinking about two options:
- Forcing cells to behave as numeric cells.
- Forgetting about DecimalFormat and use Double class specifying comma as the decimal separator, what i’m not sure it’s possible.
Any idea?
I may be missing something, but I think you just want to style the cell with a format rule to display a single decimal place
That will create a formatting rule, create a cell, set the cell to be the value 8.1, then style it