java - RichtextString notworking in hssfworkbook cell -
I want to partially color my Excel sheet cell text so that rich text string can be used for this But it is not working ... there is no error. I am unable to figure out what is wrong. This is my code.
This answer contains the string .. I want to paint the last (,), and the remaining color in red in the red color
if (Answer contains ( ",")) {String s = ","; Int second = answer.lastIndexOf (s); HSSFCell cell7 = thisRow.createCell (short) i); Cell7.setCellStyle (style2); HSSFRichTextString richTextString = New HSSFRichTextString (Answer); RichTextString.applyFont (0, second, style 5.getFontIndex ()); Cell7.setCellValue ("+ RichTextString); When I try to use cell7.setCellValue (richTextString); It says: The method is not applicable for the value of the set value (string) HSSFCell (HSSFRichTextString)
You accidentally get a rich text string with a string < / Code> with the empty string "" . This effectively removes all formatting. "" Do not include, Yonki an overloaded directly. cell7.setValue (richtextstring);
Comments
Post a Comment