Apache POI coded formatting works with MS excel 2010 but not in excel 2003
I have written code for color formatting for excel using Apache POI. The formatting for color and font came nicely in MS Excel 2010. But it does not have compatibility with excel 2003. The formatting is not there when the file opened in MS Excel 2003.
Here the sample code:
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);
If any suggestions, let me know.
I had also faced same problem .it is nothing about excel version.We must create styles before the loop and apply styles to specific cells after creating.
https://stackoverflow.com/a/11792648/1211000(it might help )
链接地址: http://www.djcxy.com/p/61238.html上一篇: '之前的表达'。' 代币