poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 55730] Fix org.apache.poi.ss.usermodel.BuiltinFormats.java for 0x29-0x2c
Date Fri, 01 Nov 2013 00:20:02 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=55730

--- Comment #6 from Eric Peters <eric@peters.org> ---
@Nick - second part of the fix:

eric@Erics-MacBook-Pro:~/Work/poi$ git diff
diff --git a/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
b/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
index 273dd89..eae651d 100644
--- a/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
+++ b/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
@@ -265,7 +265,8 @@ public class DataFormatter {
 //      int i = cellValue > 0.0 ? 0 : cellValue < 0.0 ? 1 : 2; 
 //      String formatStr = (i < formatBits.length) ? formatBits[i] :
formatBits[0];

-        String formatStr = formatStrIn;
+        // Strip out repeating characters in the number format
+        String formatStr = formatStrIn.replaceAll("\\*.","");
         // Excel supports positive/negative/zero, but java
         // doesn't, so we need to do it specially
         final int firstAt = formatStr.indexOf(';');
diff --git a/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java
b/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java
index 20825e5..d2a975e 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/TestDataFormatter.java
@@ -271,7 +271,11 @@ public class TestDataFormatter extends TestCase {
        assertEquals("12.34", dfUS.formatRawCellContents(12.343, -1, "##.##*
"));
        assertEquals("12.34", dfUS.formatRawCellContents(12.343, -1,
"##.##*1"));
        assertEquals("12.34", dfUS.formatRawCellContents(12.343, -1,
"##.##*)"));
+       assertEquals("12.34", dfUS.formatRawCellContents(12.343, -1, "*
##.##"));
        assertEquals("12.34", dfUS.formatRawCellContents(12.343, -1,
"*-##.##"));
+       assertEquals("12.34", dfUS.formatRawCellContents(12.343, -1, "_(*
#,##0.00_)"));
+
+//"_(\"$\"* #,##0.00_);_(\"$\"* (#,##0.00);_(\"$\"* \"-\"??_);_(@_)"
     }

     /**

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


Mime
View raw message