Not sure if this is the answer but it may just be a question of applying the
style to the cell first and then the over-ride to the HSSFRichTextString
object secondly. Gelow, I have pasted a section cut from the javadoc

  //create a cell style and assign the first font to it
  HSSFCellStyle style = workbook.createCellStyle();
  style.setFont(font1);

  HSSFCell hssfCell = row.createCell(idx);
  hssfCell.setCellStyle(style);

  //rich text consists of one run overriding the cell style
  HSSFRichTextString richString = new HSSFRichTextString( "Hello, World!" );
  richString.applyFont( 6, 13, font2 );
  hssfCell.setCellValue( richString );


and it demonstarates that the cell is created and a style applied to it.
Next, the HSSFRichTextString onject is created and an alternative font
applied to it and then, dinally, the rich test stirng is used to set the
value of the cell. The sequence you follow is slightly different - you apply
the over=ride to the string, set the cells value and then the cells style -
I have not tested this theory but I do think it could be a sequencing issue.

Yours

Mark B

-- 
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/Help-in-setting-underline-tp3352666p3352982.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]

Reply via email to