You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2022/07/12 09:25:57 UTC

svn commit: r1902673 - /poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java

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: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org