2012-03-14 56 views

回答

10

這可能是你在找什麼: http://poi.apache.org/spreadsheet/quick-guide.html#DrawingShapes

在解釋這一發現:

有可能使用不同的字體在文本框中的文本的樣式部分。具體方法如下:

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

+0

是得到它的感謝:) – 2012-03-14 09:26:35

1

這將打印的 「Hello 世界你好」 在細胞

XSSFRichTextString rts= new XSSFRichTextString("Hello "); 

XSSFFont fontBold= wb.createFont(); 
fontBold.setBold(true); //set bold 
fontBold.setFontHeight(12); //add font size 

rts.append("world ",fontBold); 
rts.append("Hello"); 

sheet.getRow(1).getCell(1).setCellValue(rts); 
相關問題