You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2013/03/13 13:30:34 UTC

[Bug 54686] New: Some Excel formats are displayed incorrect

https://issues.apache.org/bugzilla/show_bug.cgi?id=54686

            Bug ID: 54686
           Summary: Some Excel formats are displayed incorrect
           Product: POI
           Version: 3.8
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: Razr9@mail.ru
    Classification: Unclassified

Created attachment 30044
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30044&action=edit
DataFormatter changes

Some Excel formats are displayed incorrect in the application (fractional,
accounting and currency formats).

For example, this formats displays incorrect:

Category - Fraction:
1/4   (Up to one digit (1/4) cell type)    --> 0/
21/25 (Up to two digits (21/25) cell type) --> 1/
1/2   (As halves (1/2) cell type)          --> 0/2
2/4   (As quarters (2/4) cell type)        --> 0/4

Category - Accounting:
0,001000000   (Decimal places - 9, Symbol - р.)               --> 0,00
$ 1,234567890 (Decimal places - 9, Symbol - $English(Canada)) --> 1,23

Category - Currency:
0,001000000   (Decimal places - 9, Symbol - р.)               --> 0,00
$ 1,234567890 (Decimal places - 9, Symbol - $English(Canada)) --> 1,23

-- 
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


[Bug 54686] [PATCH] Some Excel formats are formatted incorrectly by DataFormatter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54686

Chris Lott <ch...@maultech.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chrislott@maultech.com

--- Comment #7 from Chris Lott <ch...@maultech.com> ---
Created attachment 30981
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30981&action=edit
Fraction cells in 2003 format

Adding an excel sheet suitable for use as test of fraction formatting, HTH

-- 
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


[Bug 54686] [PATCH] Some Excel formats are formatted incorrectly by DataFormatter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54686

--- Comment #8 from Tim Allison <ta...@mitre.org> ---
Thank you, Chris.  POI-55419 covers the examples you offered.  Fraction
formatting is still not perfect...there are some rounding differences btwn Java
and MSExcel...but I think the fraction component of this issue should be
closed.  

I haven't had a chance to look into the currency and accounting items that are
raised by this issue.  If you have a need and POI is failing for you in those
areas, please submit a file that shows those problems.

Thank you, again!

-- 
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


[Bug 54686] [PATCH] Some Excel formats are formatted incorrectly by DataFormatter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54686

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Some Excel formats are      |[PATCH] Some Excel formats
                   |displayed incorrect         |are formatted incorrectly
                   |                            |by DataFormatter

-- 
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


[Bug 54686] [PATCH] Some Excel formats are formatted incorrectly by DataFormatter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54686

--- Comment #2 from Tim Allison <ta...@mitre.org> ---
Created attachment 30430
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30430&action=edit
3/4's of a patch, might be good enough

Thanks to Ryan Krueger and https://issues.apache.org/jira/browse/TIKA-1132 for
the custom formatting test case on fractions.  I added some test cases, and
offer a 3/4's patch.  This patch passes 3148 tests and fails on 38.  Without
the patch, there are 3062 failurs and 124 successes.

I refactored the fraction calculator to avoid the n^2 calculations that could
lead to 100,000,000 calculations if the format was ##/####.  By "refactored," I
mean copied and pasted from org.apache.math.fraction.

-- 
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


[Bug 54686] Some Excel formats are displayed incorrect

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54686

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO
                 OS|                            |All

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
Are you able to work up a quick unit test to go with this? Just something that
tries to format a couple of different numbers with each of the formats. That
way, we'll know it's fixed, and we'll also be able to make sure it doesn't get
broken in future!

-- 
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


[Bug 54686] [PATCH] Some Excel formats are formatted incorrectly by DataFormatter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54686

--- Comment #3 from Nick Burch <ap...@gagravarr.org> ---
We debated adding a dependency on commons math, but decided against it. Copying
their code is probably more sensible, though someone came up with a
contribution which we accepted in the mean time...

Hopefully someone with slightly stronger math skills can offer an opinion on
your suggested fix!

-- 
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


[Bug 54686] [PATCH] Some Excel formats are formatted incorrectly by DataFormatter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54686

Tim Allison <ta...@mitre.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #30430|0                           |1
        is obsolete|                            |

--- Comment #4 from Tim Allison <ta...@mitre.org> ---
Created attachment 30431
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30431&action=edit
patch for fraction format

Completely agree.  Should have stepped away from the computer before submitting
the last.  This passes all tests.  Still only handles fraction formatting.

-- 
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


[Bug 54686] [PATCH] Some Excel formats are formatted incorrectly by DataFormatter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54686

--- Comment #9 from Nick Burch <ap...@gagravarr.org> ---
Just in case it isn't clear - we're still waiting on some new tests (unit test
+ sample file) that shows up the last remaining parts of this issue around
currenct / accounting formatting

With those, it should be possible to investigate what logic changes are still
needed, then work on those.

-- 
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


[Bug 54686] [PATCH] Some Excel formats are formatted incorrectly by DataFormatter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54686

--- Comment #6 from Tim Allison <ta...@mitre.org> ---
(In reply to Nick Burch from comment #5)
> Thanks for this patch Tim!
> 
> For the unit test, I renamed it to TestFractionFormat + changed package, and
> updated how it gets the test text file to be consistent with the xls, as
> well as re-enabling the single test
> 
> One thing I've just found - inner class Fraction of CellNumberFormat - seems
> to do something similar. Any chance you could cast an eye over it, and
> decide if we can rationalise / refactor to just have the one?
> 
> Patch applied (with tweaks described above) in r1494986, thanks

Thank you, Nick.  Will do.

-- 
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


[Bug 54686] [PATCH] Some Excel formats are formatted incorrectly by DataFormatter

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54686

--- Comment #5 from Nick Burch <ap...@gagravarr.org> ---
Thanks for this patch Tim!

For the unit test, I renamed it to TestFractionFormat + changed package, and
updated how it gets the test text file to be consistent with the xls, as well
as re-enabling the single test

One thing I've just found - inner class Fraction of CellNumberFormat - seems to
do something similar. Any chance you could cast an eye over it, and decide if
we can rationalise / refactor to just have the one?

Patch applied (with tweaks described above) in r1494986, thanks

-- 
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