Microsoft Excel
converts values having more than 11 digits in scientific notation when cell number format General
is used. So 842223622111
leads to 8,42224E+11
in Excel
cells having number format General
. If in Excel
the cell shall show 842223622111
, then a special number format (0
) is needed instead of General
.
You can read about available number formats in Excel for Office 365 and the special behavior of the General
format for large numbers (12 or more digits).
Libreoffice/OpenOffice Calc
will not do so. There 842223622111
stays 842223622111
in cells having number format General
.
Now, if apache poi
gets a cell containing 842223622111
and having number format General
, then DataFormatter
will format this like Excel
would also do.
If you wants DataFormatter
should format this more like Libreoffice/OpenOffice Calc
, then you could do:
...
DataFormatter fmt = new DataFormatter();
...
fmt.addFormat("General", new java.text.DecimalFormat("#.###############"));
...
Using this approach, no changes in the Excel
sheet are necessary. But of course the default behavior of apache poi
's DataFormatter
is changed. To avoid this, you could format the affected cells in Excel
using number format 0
, which is Number
without thousands separator and number of decimal decimal places = 0.
But since you mentioned that this column contains telephone numbers, the most common solution would be formatting the whole column using number format Text
(@
) . This "treats the content of a cell as text and displays the content exactly as you type it, even when you type numbers." So after that formatting was applied nothing will change to scientific notation any more.