]> source.dussan.org Git - poi.git/commitdiff
[bug-63211] fix issue with escaped % in custom number format
authorPJ Fanning <fanningpj@apache.org>
Thu, 25 Nov 2021 05:27:51 +0000 (05:27 +0000)
committerPJ Fanning <fanningpj@apache.org>
Thu, 25 Nov 2021 05:27:51 +0000 (05:27 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895313 13f79535-47bb-0310-9956-ffa450edef68

poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java

index b8bd933a9a959d012394d0af5f3e139b8b7aa1c3..ed3a447aabb76242bbdf99e77c69f966bf9e3a46 100644 (file)
@@ -606,7 +606,10 @@ public class DataFormatter {
 
     }
 
-    private String cleanFormatForNumber(String formatStr) {
+    private String cleanFormatForNumber(String formatStrIn) {
+        // this replace is done to fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63211
+        String formatStr = formatStrIn.replace("\\%", "\'%\'");
+
         StringBuilder sb = new StringBuilder(formatStr);
 
         if (emulateCSV) {