diff options
author | PJ Fanning <fanningpj@apache.org> | 2021-12-24 11:11:44 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2021-12-24 11:11:44 +0000 |
commit | dfb4af31e718b46cab77a4e5b3fd0d3f9eadd6a5 (patch) | |
tree | c23242c4b3114334cf4b2b5fdea1e782e627cb03 /poi-ooxml | |
parent | 0a916cd3e7167bad473c90791a931c2ef4015a6b (diff) | |
download | poi-dfb4af31e718b46cab77a4e5b3fd0d3f9eadd6a5.tar.gz poi-dfb4af31e718b46cab77a4e5b3fd0d3f9eadd6a5.zip |
preserve rich text in cell copy
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896348 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
-rw-r--r-- | poi-ooxml/src/test/java/org/apache/poi/ss/tests/util/TestXSSFCellUtilCopy.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/poi-ooxml/src/test/java/org/apache/poi/ss/tests/util/TestXSSFCellUtilCopy.java b/poi-ooxml/src/test/java/org/apache/poi/ss/tests/util/TestXSSFCellUtilCopy.java index 24e53c68f9..720218ace6 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/ss/tests/util/TestXSSFCellUtilCopy.java +++ b/poi-ooxml/src/test/java/org/apache/poi/ss/tests/util/TestXSSFCellUtilCopy.java @@ -17,8 +17,10 @@ package org.apache.poi.ss.tests.util; +import org.apache.poi.ss.usermodel.RichTextString; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.util.BaseTestCellUtilCopy; +import org.apache.poi.xssf.usermodel.XSSFRichTextString; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class TestXSSFCellUtilCopy extends BaseTestCellUtilCopy { @@ -27,4 +29,15 @@ public class TestXSSFCellUtilCopy extends BaseTestCellUtilCopy { protected Workbook createNewWorkbook() { return new XSSFWorkbook(); } + + @Override + protected boolean compareRichText(RichTextString rts1, RichTextString rts2) { + if (rts1 instanceof XSSFRichTextString && rts2 instanceof XSSFRichTextString) { + XSSFRichTextString xrts1 = (XSSFRichTextString)rts1; + XSSFRichTextString xrts2 = (XSSFRichTextString)rts2; + return xrts1.getCTRst().xmlText().equals(xrts2.getCTRst().xmlText()); + } else { + return super.compareRichText(rts1, rts2); + } + } } |