5
我使用apache-poi来生成excel文件。我需要将第4列设置为只读,其余2列可以由用户编辑。使用apache poi创建列只读
我使用XSSFCellStyle
来达到这个目标,但它不适合我。
整个代码为:
Map<String, XSSFCellStyle> styles = new HashMap<String, XSSFCellStyle>();
XSSFCellStyle style5 = wb.createCellStyle();
XSSFFont headerFont = wb.createFont();
headerFont.setBold(true);
style5.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
style5.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND);
style5.setFont(headerFont);
style5.setLocked(true); // this line does not get executed.
styles.put("header", style5);
你是什么意思时,你说行不没有得到执行?你有例外吗? – Pieter 2011-12-14 10:00:52