import org.apache.poi.ss.usermodel.Cell;\r
import org.apache.poi.ss.usermodel.DataFormatter;\r
import org.apache.poi.ss.usermodel.DateUtil;\r
+import org.apache.poi.ss.usermodel.RichTextString;\r
import org.apache.poi.ss.usermodel.Row;\r
import org.apache.poi.ss.usermodel.Sheet;\r
import org.apache.poi.ss.usermodel.Workbook;\r
wb.removeSheetAt(sn);\r
}\r
}\r
+\r
+ // When this is fixed, the test case should go to BaseTestXCell with \r
+ // adjustments to use _testDataProvider to also verify this for XSSF\r
+ public void testBug57294() throws IOException {\r
+ Workbook wb = SXSSFITestDataProvider.instance.createWorkbook();\r
+ \r
+ Sheet sheet = wb.createSheet();\r
+ Row row = sheet.createRow(0);\r
+ Cell cell = row.createCell(0);\r
+ \r
+ RichTextString str = new XSSFRichTextString("Test rich text string");\r
+ str.applyFont(2, 4, (short)0);\r
+ assertEquals(3, str.numFormattingRuns());\r
+ cell.setCellValue(str);\r
+ \r
+ Workbook wbBack = SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);\r
+ wb.close();\r
+ \r
+ // re-read after serializing and reading back\r
+ Cell cellBack = wbBack.getSheetAt(0).getRow(0).getCell(0);\r
+ assertNotNull(cellBack);\r
+ RichTextString strBack = cellBack.getRichStringCellValue();\r
+ assertNotNull(strBack);\r
+ assertEquals(3, strBack.numFormattingRuns());\r
+ assertEquals(0, strBack.getIndexOfFormattingRun(0));\r
+ assertEquals(2, strBack.getIndexOfFormattingRun(1));\r
+ assertEquals(4, strBack.getIndexOfFormattingRun(2));\r
+ }\r
}\r