使用apache poi将单元格内容的一部分设置为粗体? [英] Setting a part of the cell contents to bold using apache poi?
问题描述
如何将此字符串放入使用java apache poi的单元格中?
字符串是Hello world Hello
因为您可以看到我需要将文本的一部分加粗?
我可以将单元格的全部内容设置为粗体而不是特定部分。
请帮助我。
How can i put this string in to a cell using java apache poi?
The string is "Hello world Hello"
As u can see i need to make a part of the text bold?
I'm able to set the entire contents of the cell to bold but not specific parts.
Please help me.
推荐答案
这可能是您要查找的内容:
http://poi.apache.org/spreadsheet/quick-guide.html #DrawingShapes
This is probably what you are looking for: http://poi.apache.org/spreadsheet/quick-guide.html#DrawingShapes
在解释中找到这个:
Find this in the explanation:
可以使用不同的字体来设置文本框中文本的部分样式。这里是:
It's possible to use different fonts to style parts of the text in the textbox. Here's how:
HSSFFont font = wb.createFont();
font.setItalic(true);
font.setUnderline(HSSFFont.U_DOUBLE);
HSSFRichTextString string = new HSSFRichTextString("Woo!!!");
string.applyFont(2,5,font);
textbox.setString(string );
这可能很有用: http://apache-poi.1045710.n5.nabble.com/Multiple-text-styles-in -Excel-cell-td4922683.html
这篇关于使用apache poi将单元格内容的一部分设置为粗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!