poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 58471] New: [PATCH] Format numbers more like Excel
Date Fri, 02 Oct 2015 10:57:16 GMT

            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: dev@poi.apache.org
          Reporter: cmb-apache@corefiling.co.uk

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

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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message