poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Beardsley <markbrd...@tiscali.co.uk>
Subject Re: RichTextString isn't working for SXSSFWorkbook
Date Wed, 12 Dec 2012 18:03:19 GMT
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.setFontHeightInPoints((short) 12);
        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();

        XSSFFont font2 = (XSSFFont) wb.createFont();
        font2.setColor(new XSSFColor(new java.awt.Color(0, 255, 0)));

        XSSFRichTextString rt = (XSSFRichTextString)
wb.getCreationHelper().createRichTextString("Hello, World!");
        rt.applyFont( 6, 13, font2 );


        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: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org

View raw message