代碼如下:
cell0To3.setCellValue("變更內容:"+changeContent);
String title = cell0To3.getStringCellValue();
Font black = wb.getFontAt(cell0To3.getCellStyle().getFontIndex());
XSSFRichTextString richString = new XSSFRichTextString("變更內容:"+changeContent);
//通過索引指定哪些文字需要什么顏色
richString.applyFont(5, title.length(), black); //字體顯示哪部分字符設置新的字體樣式Font
cell0To3.setCellValue(richString);
