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:40:29 UTC
svn commit: r1902674 - /poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java
Author: fanningpj
Date: Tue Jul 12 09:40:29 2022
New Revision: 1902674
URL: http://svn.apache.org/viewvc?rev=1902674&view=rev
Log:
allow XSSF RTS
Modified:
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java?rev=1902674&r1=1902673&r2=1902674&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java Tue Jul 12 09:40:29 2022
@@ -495,20 +495,29 @@ public class HSSFCell extends CellBase {
// so handle things as a normal rich text cell
if (_cellType != CellType.STRING) {
- int row=_record.getRow();
- short col=_record.getColumn();
- short styleIndex=_record.getXFIndex();
+ int row = _record.getRow();
+ short col = _record.getColumn();
+ short styleIndex = _record.getXFIndex();
setCellType(CellType.STRING, false, row, col, styleIndex);
}
- int index;
- HSSFRichTextString hvalue = (HSSFRichTextString) value;
- UnicodeString str = hvalue.getUnicodeString();
- index = _book.getWorkbook().addSSTString(str);
- (( LabelSSTRecord ) _record).setSSTIndex(index);
- _stringValue = hvalue;
- _stringValue.setWorkbookReferences(_book.getWorkbook(), (( LabelSSTRecord ) _record));
- _stringValue.setUnicodeString(_book.getWorkbook().getSSTString(index));
+ if (value instanceof HSSFRichTextString) {
+ HSSFRichTextString hvalue = (HSSFRichTextString) value;
+ UnicodeString str = hvalue.getUnicodeString();
+ int index = _book.getWorkbook().addSSTString(str);
+ (( LabelSSTRecord ) _record).setSSTIndex(index);
+ _stringValue = hvalue;
+ _stringValue.setWorkbookReferences(_book.getWorkbook(), (( LabelSSTRecord ) _record));
+ _stringValue.setUnicodeString(_book.getWorkbook().getSSTString(index));
+ } else {
+ HSSFRichTextString hvalue = new HSSFRichTextString(value.getString());
+ UnicodeString str = hvalue.getUnicodeString();
+ int index = _book.getWorkbook().addSSTString(str);
+ (( LabelSSTRecord ) _record).setSSTIndex(index);
+ _stringValue = hvalue;
+ _stringValue.setWorkbookReferences(_book.getWorkbook(), (( LabelSSTRecord ) _record));
+ _stringValue.setUnicodeString(_book.getWorkbook().getSSTString(index));
+ }
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org