Author: fanningpj
Date: Tue Jul 12 09:25:57 2022
New Revision: 1902673

URL: http://svn.apache.org/viewvc?rev=1902673&view=rev
Log:
allow HSSFSharedString

Modified:
    
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java

Modified: 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java?rev=1902673&r1=1902672&r2=1902673&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java 
(original)
+++ 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java 
Tue Jul 12 09:25:57 2022
@@ -354,12 +354,18 @@ public final class XSSFCell extends Cell
             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));
             }
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to