aboutsummaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2022-07-12 09:40:29 +0000
committerPJ Fanning <fanningpj@apache.org>2022-07-12 09:40:29 +0000
commit8fbe3966dd0d18130d5f8e5625e9b1c69ce0c297 (patch)
tree5e1267bbc84dd6e5ed5d6a5f924bef61e1b832e7 /poi
parent7ab33527129bac5b400b1b055f3128f34716d9c8 (diff)
downloadpoi-8fbe3966dd0d18130d5f8e5625e9b1c69ce0c297.tar.gz
poi-8fbe3966dd0d18130d5f8e5625e9b1c69ce0c297.zip
allow XSSF RTS
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1902674 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java33
1 files changed, 21 insertions, 12 deletions
diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java
index 8e64af4487..8fec6a00a1 100644
--- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java
+++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java
@@ -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