2012-08-10 74 views
2

我已经使用Apache POI编写了用于Excel的颜色格式化代码。颜色和字体的格式来很好地在MS Excel 2010中但它没有与2003年的Excel兼容的格式是不是有当文件在MS Excel 2003Apache POI编码格式适用于MS Excel 2010,但不适用于Excel 2003

下面的示例代码中打开:

CellStyle style = getWorkbook().createCellStyle(); 

    Font font = wb.createFont(); 
    font.setBoldweight(Font.BOLDWEIGHT_BOLD); 
    font.setFontHeightInPoints((short)11); 

    style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex()); 
    style.setFillPattern(CellStyle.SOLID_FOREGROUND); 

    Cell cell = excelRow.createCell(10); 
    cell.setCellStyle(style); 

如果有任何建议,请告诉我。

+1

您没有使用style.setFont,为什么你的定义的字体显示,2010年吧? – Alfabravo 2012-08-10 14:49:42

+0

@Alfabravo:我在我的原始代码中使用了style.setFont(font)。由于我不能把所有的代码放在这里,我修剪了一些代码。 – undisputed 2012-08-13 08:23:35

回答

相关问题