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 2012/06/08 22:09:04 UTC

[Bug 53389] New: DataFormatter not removing locale for number cell

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

          Priority: P2
            Bug ID: 53389
          Assignee: dev@poi.apache.org
           Summary: DataFormatter not removing locale for number cell
          Severity: normal
    Classification: Unclassified
                OS: Windows XP
          Reporter: robert.kish@ncogroup.com
          Hardware: PC
            Status: NEW
           Version: 3.8
         Component: POI Overall
           Product: POI

The DataFormatter is not removing the locale when given the format string
[$-1010409]General for a number cell. The resulting format String is "General",
but is applied too late.

In org.apache.poi.ss.usermodel.DataFormatter.getFormat(double, int, String), at
the end of the function, createFormat is called. However, if the resulting
format is "General" (or I assume "@" also), the logic a couple lines earlier to
return generalWholeNumFormat or generalDecimalNumFormat does not apply. If the
code were rearranged to apply this check (again?) after createFormat is called,
then a valid format could be used.

For the Junit, org.apache.poi.ss.usermodel.TestDataFormatter, (I stuck it in
testOther), you can add the following to demonstrate this case:

assertEquals("63", dfUS.formatRawCellContents(63.0, -1, "[$-1010409]General"));

I expect "63". The code outputs "General".

-- 
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 53389] DataFormatter not removing locale for number cell

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

--- Comment #2 from Robert Kish <ro...@ncogroup.com> ---
(In reply to comment #1)
> Is the lack of locale removal only affecting the General case, or does it
> apply to all formats (custom and built in)?
> 
> (This should help us work out what area to focus on)

General and @ are the ones not working as expected. Other formats, such as ##
and 00 are working fine when a locale is present.

These 2 fail:
assertEquals("63", dfUS.formatRawCellContents(63.0, -1, "[$-1010409]General"));
assertEquals("63", dfUS.formatRawCellContents(63.0, -1, "[$-1010409]@"));

These 2 are fine:
assertEquals("63", dfUS.formatRawCellContents(63.0, -1, "[$-1010409]##"));
assertEquals("63", dfUS.formatRawCellContents(63.0, -1, "[$-1010409]00"));      

I put all 4 formats in Excel 2003, and when saved to CSV, they export as "63".

-- 
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 53389] DataFormatter not removing locale for number cell

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

Nick Burch <ni...@alfresco.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Nick Burch <ni...@alfresco.com> ---
Fixed in r1349562, and unit tests added based on your supplied example ones,
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


[Bug 53389] DataFormatter not removing locale for number cell

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

Nick Burch <ni...@alfresco.com> changed:

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

--- Comment #1 from Nick Burch <ni...@alfresco.com> ---
Is the lack of locale removal only affecting the General case, or does it apply
to all formats (custom and built in)?

(This should help us work out what area to focus on)

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