No need for explicit formatting, Apache POI provides for DataFormatter
class as utility to leverage the format of the content as it appears on the excel. You can choose custom formats too, a simple example would be (cell is reference to your XSSFCell
object):
System.out.println(new DataFormatter().formatCellValue(cell));
Excel sheet looks like:
Using DataFormatter
(sop statement above) prints:
50%
$ 1,200
12/21/14
Where your normal formatting would print:
0.5
1200.0
21-Dec-2014