-1
我想爲我的excel工作表單元格文本部分着色,所以我使用richtextstring爲此,但它不工作......沒有error.i無法找出什麼是錯的。 這是我的代碼。RichtextString不工作在hssfworkbook單元格
在這個答案是字符串..我要的顏色字符串到最後(,)以紅色和留在黑色
if (answer.contains(",")) {
String s = ",";
int second = answer.lastIndexOf(s);
HSSFCell cell7 = thisRow.createCell((short) i);
cell7.setCellStyle(style2);
HSSFRichTextString richTextString = new HSSFRichTextString(
answer);
richTextString.applyFont(0, second, style5.getFontIndex());
cell7.setCellValue("" + richTextString);
When i try to use cell7.setCellValue(richTextString);
it says :
The method setCellValue(String) in the type HSSFCell is not applicable for the arguments (HSSFRichTextString)
cell7.setValue(richTextString);沒有采取richtextstring這就是爲什麼我已經連接「」 – kirti 2014-10-09 04:09:27