diff options
author | PJ Fanning <fanningpj@apache.org> | 2022-07-12 09:25:57 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2022-07-12 09:25:57 +0000 |
commit | 7ab33527129bac5b400b1b055f3128f34716d9c8 (patch) | |
tree | 93a2bbb7df5951147f5bfb84654796bfcc6c61e0 | |
parent | e39ab54eff96c50f36773612797d2a48b1eda724 (diff) | |
download | poi-7ab33527129bac5b400b1b055f3128f34716d9c8.tar.gz poi-7ab33527129bac5b400b1b055f3128f34716d9c8.zip |
allow HSSFSharedString
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1902673 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java index 23e33a2497..0a85c786c7 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java @@ -354,12 +354,18 @@ public final class XSSFCell extends CellBase { if(_cell.getT() == STCellType.INLINE_STR) { //set the 'pre-evaluated result _cell.setV(str.getString()); - } else { + } else if (str instanceof XSSFRichTextString) { _cell.setT(STCellType.S); XSSFRichTextString rt = (XSSFRichTextString)str; rt.setStylesTableReference(_stylesSource); int sRef = _sharedStringSource.addSharedStringItem(rt); _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)); } } } |