How to make a range of text bold text style using Apache POI? Eg:
Instead of applying style for the entire cell. I used to do this in vb.net with these lines of code:
excellSheet.Range("C2").Value = "Priority: " + priority
excellSheet.Range("C2").Characters(0, 8).Font.Bold = True
But I can't find the way to do that in Java using Apache POI.
Any help will be much appreciated. Thanks!
First, create your
Font
with bold styling, using theWorkbook
object.Next, grab the
RichTextString
from theCell
and call theapplyFont
overload that takes a range of indexes and theFont
to apply.You should reuse the
Font
object if you want to convert other text in the workbook to bold.