-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