What happens if you make a simple change to the sequence of your method
class, a little like this;
public Workbook createRichTextWorkbook() {
Workbook wb = new SXSSFWorkbook();
Sheet copySheet = wb.createSheet("TestRT");
Row copyRow = copySheet.createRow(0);
Cell copyCell = copyRow.createCell(0);
XSSFFont font1 = (XSSFFont) wb.createFont();
font1.setFontName("Arial");
font1.setFontHeightInPoints((short) 12);
font1.setBold(true);
font1.setColor(new XSSFColor(new java.awt.Color(255, 0, 0)));
//create a cell style and assign the first font to it
CellStyle style = wb.createCellStyle();
style.setFont(font1);
copyCell.setCellStyle(style);
XSSFFont font2 = (XSSFFont) wb.createFont();
font2.setFontName("Arial");
font2.setFontHeightInPoints((short)12);
font2.setItalic(true);
font2.setColor(new XSSFColor(new java.awt.Color(0, 255, 0)));
XSSFRichTextString rt = (XSSFRichTextString)
wb.getCreationHelper().createRichTextString("Hello, World!");
rt.applyFont( 6, 13, font2 );
copyCell.setCellValue(rt);
return wb;
}
I am just wondering if assigning the style to the cell as you did originally
was taken by POI to indicate that this style should over-ride anything else
applied to the cells contents. I do not know if this is the case but it
might be the first place to look for an answer.
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/RichTextString-isn-t-working-for-SXSSFWorkbook-tp5711695p5711696.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]