allow HSSFSharedString

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1902673 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2022-07-12 09:25:57 +00:00
parent e39ab54eff
commit 7ab3352712
1 changed files with 7 additions and 1 deletions

View File

@ -354,12 +354,18 @@ public final class XSSFCell extends CellBase {
if(_cell.getT() == STCellType.INLINE_STR) { if(_cell.getT() == STCellType.INLINE_STR) {
//set the 'pre-evaluated result //set the 'pre-evaluated result
_cell.setV(str.getString()); _cell.setV(str.getString());
} else { } else if (str instanceof XSSFRichTextString) {
_cell.setT(STCellType.S); _cell.setT(STCellType.S);
XSSFRichTextString rt = (XSSFRichTextString)str; XSSFRichTextString rt = (XSSFRichTextString)str;
rt.setStylesTableReference(_stylesSource); rt.setStylesTableReference(_stylesSource);
int sRef = _sharedStringSource.addSharedStringItem(rt); int sRef = _sharedStringSource.addSharedStringItem(rt);
_cell.setV(Integer.toString(sRef)); _cell.setV(Integer.toString(sRef));
} else {
_cell.setT(STCellType.S);
XSSFRichTextString rt = new XSSFRichTextString(str.getString());
rt.setStylesTableReference(_stylesSource);
int sRef = _sharedStringSource.addSharedStringItem(rt);
_cell.setV(Integer.toString(sRef));
} }
} }
} }