Excel导出设置标题格填充颜色setFillForegroundColor无效问题

1
2
3
cellStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
加上下面的属性就可以了
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);

Excel设置全局文本类型

1
2
3
4
5
//创建默认的单元格默认文本样式
CellStyle textCellStyle = book.createCellStyle();
DataFormat dataFormat = book.createDataFormat();
textCellStyle.setDataFormat(dataFormat.getFormat("@"));
cellStyleMap.put("textCommon", textCellStyle);