由于最新的2.0.0-beta5版本将原来的Sheet类删除了,它的设置单元格格式方法setTableStyle及setColumnWidthMap方法也不能用,所以整理了一下方法。
/**
* 创建默认表头及内容格式
* @return HorizontalCellStyleStrategy
*/
private HorizontalCellStyleStrategy createDefaultStyle() {
// 头的策略
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
// 背景设置为白色
headWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
// 表头的字体属性设置
WriteFont headFont = new WriteFont();
// 字体及大小
headFont.setFontName(DEFAULT_FONT_ARIAL);
headFont.setFontHeightInPoints((short)10);
// 是否加粗
headFont.setBold(false);
headWriteCellStyle.setWriteFont(headFont);
// 内容的策略
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
WriteFont contentFont = new WriteFont();
contentFont.setFontName(DEFAULT_FONT_ARIAL);
contentFont.setFontHeightIn