Bug 60906 -- fix style index

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1788282 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tim Allison 2017-03-23 16:31:42 +00:00
parent 398a7197bd
commit e40c26b56d
2 changed files with 10 additions and 4 deletions

View File

@ -192,7 +192,8 @@ public class XSSFBSheetHandler extends XSSFBParser {
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);
}

View File

@ -48,11 +48,16 @@ public class XSSFBStylesTable extends XSSFBParser {
}
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