Results 1 to 1 of 1
  1. #1
    nn12 is offline Member
    Join Date
    Sep 2008
    Posts
    85
    Rep Power
    0

    Default Help with Apace POI in setting underline

    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.

    Java Code:
    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);
    Last edited by nn12; 01-22-2011 at 08:01 AM.

Similar Threads

  1. Help, Setting Key Code
    By quafflepunch in forum New To Java
    Replies: 2
    Last Post: 01-05-2011, 02:37 AM
  2. Help setting up JavaDB
    By java_beginner in forum JDBC
    Replies: 1
    Last Post: 05-08-2010, 09:34 AM
  3. need help setting up GUI objects
    By robertbob in forum New To Java
    Replies: 1
    Last Post: 05-07-2010, 04:03 AM
  4. Setting the DSN
    By tim in forum JDBC
    Replies: 1
    Last Post: 02-14-2008, 10:55 PM
  5. Help with setting up please
    By BlitzA in forum New To Java
    Replies: 6
    Last Post: 12-29-2007, 01:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •