Yes. You are right. It can be done with RichTextString

CreationHelper ch = wb.getCreationHelper();
...
RichTextString rts = ch.createRichTextString("abcdefghij");
Font f1 = wb.createFont();
f1.setColor(......RED...)
Font f2 = wb.createFont();
f2.setColor(.....
rts.applyFont(0, 5, f1);
rts.applyFont(6, 8, f2);

...

rgds,



> To: [email protected]
> Subject: Re: Can POI(Excel) change cell font color partially
> From: [email protected]
> Date: Tue, 28 Sep 2010 09:53:11 -0400
> 
> Did you try using a "RichTextString" ?  I have never used it, but from the 
> help file it looks like it might do what you need.
> -Lou
> 
> 
> 
> floydF floydL <[email protected]> wrote on 09/28/2010 09:45:00 AM:
> 
> > A cell whose text is 'hello world' in black color can be modified to
> > 'hello'-red & 'world'-blue ? A cell with two colors... -- the office 
> excel
> > can easily do this(event the excel2002)
> > 
> > i check the POI example,found the following code
> > 'f.setColor( IndexedColors.RED.getIndex() ); ' which cannot fill my 
> needs.
> > Any suggestion is appreciated.
                                          

Reply via email to