Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7621205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:08:19+00:00 2026-05-31T04:08:19+00:00

If I crack open MS Excel (I assume), or LibreOffice Calc (tested), I can

  • 0

If I crack open MS Excel (I assume), or LibreOffice Calc (tested), I can type stuff into a cell, and change the font of parts of the text in a cell, such as doing, in one cell, :

This text is bold and this text is italicized

Again, let me reiterate, that this string could exist in the shown format in one cell.

Can this level of customization be achieved with Apache POI? Searching only seems to show how to apply a font to an entire cell.

Thanks

===UPDATE===

As suggested below, I ended up going with the HSSFRichTextString (as I’m working with HSSF). However, after applying fonts (I tried bold and underline), my text would remain unchanged. This is what I attempted. To put things in context, I am working on something sports-related, in which it is common to display a match up in the form “awayteam”@”hometeam”, and depending on certain external conditions, I would like to make one or the other bold. My code looks something like this:

    String away = "foo";
    String home = "bar";
    String bolden = "foo"
    HSSFRichTextString val = new HSSFRichTextString(away+"@"+home);

    if(bolden.equals(home)) {
        val.applyFont(val.getString().indexOf("@") + 1, val.length(), Font.U_SINGLE);
    } else if(bolden.equals(away)) {
        val.applyFont(0, val.getString().indexOf("@"), Font.U_SINGLE);
    }
    gameHeaderRow.createCell(g + 1).setCellValue(val);

As you can see, this is a snippet of code from a more complicated function than is displayed, but the brunt of this is actual code. As you can see, I’m doing val.applyFont to part of a string, and then setting a cell value with the string. So I’m not entirely sure what I did wrong there. Any advice is appreciated.

Thanks

KFJ

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:08:21+00:00Added an answer on May 31, 2026 at 4:08 am

    POI does support it, the class you’re looking for is RichTextString. If your cell is a text one, you can get a RichTextString for it, then apply fonts to different parts of it to make different parts of the text look different.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Its been a long time since I've needed to crack open an .htaccess file...
Is there a command line tool that will crack open a JAR file and
I am taking my first crack at Maven and ran into a problem. We
I am having a crack at Backbone and decided to open a jsFiddle to
So I've run into a wall trying to crack why this WordPress install hogs
I've been at this for a few days now and just can't crack the
How can I crack two ciphertexts that have used the same key twice? For
Had a good crack at this, quite a few articles around but I can't
Simple stuff but somehow not able to crack it, below piece of code gives
I'm a complete C# newbie and have been trying to crack this for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.