Skip to content

Adding multi-style text in a XLS Cell using POI

December 13, 2011

HSSFCell firstRowCell0=firstRow.createCell(0);


String welcomeMessage = “Welcome to JASOKAN.WORDPRESS.COM”;
int wcMessageLength = welcomeMessage.length();
HSSFRichTextString richTextSample= new HSSFRichTextString(welcomeMessage);
HSSFFont underlinedFont = testWorkBook.createFont();
underlinedFont.setFontHeightInPoints((short) 10);
underlinedFont.setFontName(“MS Mincho”);

The HSSFRichTextString makes the magic of underlining the content. So, this can be replicated to other formats <b>, <i> etc.,

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: