Hi, I need to display text in the following format in the excel:

The entire sentence should be bold and the word great should be underlined.

*This line is great buddy.*

I tried with the following code shown below. But the o/p of this is

*This line is* *great* buddy

which is not what I want.

HSSFCellStyle boldStyle;
HSSFRow row;
HSSFCell cell;
boldStyle = _workbook.createCellStyle();
boldFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
boldStyle.setFont(boldFont);
HSSFFont textFont = _workbook.createFont();
                textFont.setUnderline(HSSFFont.U_SINGLE);
                row = sheet.createRow((short) currentRow);
                cell = row.createCell((short) 0);
                HSSFRichTextString colortext = new HSSFRichTextString("This 
line is
great buddy");
                colortext.applyFont(12, 17, textFont);
                cell.setCellValue(colortext);
                cell.setCellStyle(boldStyle);

Reply via email to