https://bz.apache.org/bugzilla/show_bug.cgi?id=58471
Bug ID: 58471
Summary: [PATCH] Format numbers more like Excel
Product: POI
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: SS Common
Assignee: [email protected]
Reporter: [email protected]
Created attachment 33155
--> https://bz.apache.org/bugzilla/attachment.cgi?id=33155&action=edit
Patch to format numbers more like Excel
The current DataFormatter differs slightly from Excel's formatting, which is
documented at https://support.microsoft.com/en-us/kb/65903 (Summary, 3rd
sentence onward) regarding when to use scientific notation and counting the
decimal point towards the character limit. It also differs on rounding mode,
which in Excel appears to be HALF_UP (this does not appear to be documented).
I attach a patch adding and using a new ExcelGeneralNumberFormat which matches
Excel in a variety of test cases. This is useful for users who want to
construct an error message quoting the cell value as it would be shown in
Excel.
Note that this all matches the longest string Excel will display given a
sufficiently wide cell. In the default cell width, it uses a smaller number of
characters, and I don't know if that number and/or the cell width vary with
display settings/DPI, accessibility settings, available fonts, etc., so the
wide-cell value seemed the best thing to target.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]