]> source.dussan.org Git - poi.git/commitdiff
bug 61053 -- not a fix, but this aligns XSSFBSheetHandler's behavior with streaming...
authorTim Allison <tallison@apache.org>
Tue, 20 Jun 2017 12:59:33 +0000 (12:59 +0000)
committerTim Allison <tallison@apache.org>
Tue, 20 Jun 2017 12:59:33 +0000 (12:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1799345 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xssf/binary/XSSFBSheetHandler.java

index def489f12c88486d9ff1efa301bf6b03eda6f1e6..819281f6506522f7b5f8bfeb0efac331000ebde2 100644 (file)
@@ -21,6 +21,7 @@ package org.apache.poi.xssf.binary;
 import java.io.InputStream;
 import java.util.Queue;
 
+import org.apache.poi.ss.usermodel.BuiltinFormats;
 import org.apache.poi.ss.usermodel.DataFormatter;
 import org.apache.poi.ss.util.CellAddress;
 import org.apache.poi.util.Internal;
@@ -193,6 +194,14 @@ public class XSSFBSheetHandler extends XSSFBParser {
     private String formatVal(double val, int styleIdx) {
         String formatString = styles.getNumberFormatString(styleIdx);
         short styleIndex = styles.getNumberFormatIndex(styleIdx);
+        //for now, if formatString is null, silently punt
+        //and use "General".  Not the best behavior,
+        //but we're doing it now in the streaming and non-streaming
+        //extractors for xlsx.  See BUG-61053
+        if (formatString == null) {
+            formatString = BuiltinFormats.getBuiltinFormat(0);
+            styleIndex = 0;
+        }
         return dataFormatter.formatRawCellContents(val, styleIndex, formatString);
     }