bug 61053 -- not a fix, but this aligns XSSFBSheetHandler's behavior with streaming and non-streaming extractors for xlsx

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1799345 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tim Allison 2017-06-20 12:59:33 +00:00
parent 74528521a2
commit f758bbb915
1 changed files with 9 additions and 0 deletions

View File

@ -21,6 +21,7 @@ package org.apache.poi.xssf.binary;
import java.io.InputStream; import java.io.InputStream;
import java.util.Queue; import java.util.Queue;
import org.apache.poi.ss.usermodel.BuiltinFormats;
import org.apache.poi.ss.usermodel.DataFormatter; import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.util.CellAddress; import org.apache.poi.ss.util.CellAddress;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
@ -193,6 +194,14 @@ public class XSSFBSheetHandler extends XSSFBParser {
private String formatVal(double val, int styleIdx) { private String formatVal(double val, int styleIdx) {
String formatString = styles.getNumberFormatString(styleIdx); String formatString = styles.getNumberFormatString(styleIdx);
short styleIndex = styles.getNumberFormatIndex(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); return dataFormatter.formatRawCellContents(val, styleIndex, formatString);
} }