Hi
I am trying to work with rich text example from POI and one of my use cases
requires text with different font characteristics
in the same cell
The WorkingWithRichText.java example is of great help and exactly provide me
with what I need to do.
However I discovred that the font size is not applicable to chunks of rich
text. As in the code below I just added the first part of the text to have a
size of 22 and it is not displayed
Can any of the authors kindly help with this bug or has it been resolved in
Beta 5.I am using Beta 4.
Here is the code with a small change (a single line of code change for font
size =22)
XSSFWorkbook wb = new XSSFWorkbook(); //or new HSSFWorkbook();
XSSFSheet sheet = wb.createSheet();
XSSFRow row = sheet.createRow((short) 2);
XSSFCell cell = row.createCell(1);
XSSFRichTextString rt = new XSSFRichTextString("The quick brown fox");
XSSFFont font1 = wb.createFont();
font1.setBold(true);
font1.setFontHeight((short)22);
font1.setFontName("Arial");
font1.setColor(new XSSFColor(new java.awt.Color(255, 0, 0)));
rt.applyFont(0, 10, font1);
XSSFFont font2 = wb.createFont();
font2.setItalic(true);
font2.setUnderline(XSSFFont.U_DOUBLE);
font2.setColor(new XSSFColor(new java.awt.Color(0, 255, 0)));
rt.applyFont(10, 19, font2);
XSSFFont font3 = wb.createFont();
font3.setColor(new XSSFColor(new java.awt.Color(0, 0, 255)));
rt.append(" Jumped over the lazy dog", font3);
cell.setCellValue(rt);
// Write the output to a file
FileOutputStream fileOut = new FileOutputStream("xssf-richtext.xlsx");
wb.write(fileOut);
fileOut.close();
Any pointers/help is highly appreciated.
Regards
Avinash