You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ta...@apache.org on 2017/03/23 16:31:42 UTC

svn commit: r1788282 - in /poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary: XSSFBSheetHandler.java XSSFBStylesTable.java

Author: tallison
Date: Thu Mar 23 16:31:42 2017
New Revision: 1788282

URL: http://svn.apache.org/viewvc?rev=1788282&view=rev
Log:
Bug 60906 -- fix style index

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFBSheetHandler.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFBStylesTable.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFBSheetHandler.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFBSheetHandler.java?rev=1788282&r1=1788281&r2=1788282&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFBSheetHandler.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFBSheetHandler.java Thu Mar 23 16:31:42 2017
@@ -192,7 +192,8 @@ public class XSSFBSheetHandler extends X
         beforeCellValue(data);
         double val = rkNumber(data, XSSFBCellHeader.length);
         String formatString = styles.getNumberFormatString(cellBuffer.getStyleIdx());
-        String formattedVal = dataFormatter.formatRawCellContents(val, cellBuffer.getStyleIdx(), formatString);
+        short styleIndex = styles.getNumberFormatIndex(cellBuffer.getStyleIdx());
+        String formattedVal = dataFormatter.formatRawCellContents(val, styleIndex, formatString);
         handleCellValue(formattedVal);
     }
 

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFBStylesTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFBStylesTable.java?rev=1788282&r1=1788281&r2=1788282&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFBStylesTable.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/binary/XSSFBStylesTable.java Thu Mar 23 16:31:42 2017
@@ -48,11 +48,16 @@ public class XSSFBStylesTable extends XS
     }
 
     String getNumberFormatString(int idx) {
-        if (numberFormats.containsKey(styleIds.get((short)idx))) {
-            return numberFormats.get(styleIds.get((short)idx));
+        short numberFormatIdx = getNumberFormatIndex(idx);
+        if (numberFormats.containsKey(numberFormatIdx)) {
+            return numberFormats.get(numberFormatIdx);
         }
 
-        return BuiltinFormats.getBuiltinFormat(styleIds.get((short)idx));
+        return BuiltinFormats.getBuiltinFormat(numberFormatIdx);
+    }
+
+    short getNumberFormatIndex(int idx) {
+        return styleIds.get(idx);
     }
 
     @Override



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org