c3.setCellFormula("SUM(C3:C32)");
}
private Map<String, CellStyle> createStyles(Workbook wb) {
styles = Maps.newHashMap();
DataFormat df = wb.createDataFormat();
// --字体设定 --//
//普通字体
Font normalFont = wb.createFont();
normalFont.setFontHeightInPoints((short) 10);
//加粗字体
Font boldFont = wb.createFont();
boldFont.setFontHeightInPoints((short) 10);
boldFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
//蓝色加粗字体
Font blueBoldFont = wb.createFont();
blueBoldFont.setFontHeightInPoints((short) 10);
blueBoldFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
blueBoldFont.setColor(IndexedColors.BLUE.getIndex());
// --Cell Style设定-- //
//标题格式
CellStyle headerStyle = wb.createCellStyle();
headerStyle.setFont(boldFont);
styles.put("header", headerStyle);
//日期格式
CellStyle dateCellStyle = wb.createCellStyle();
dateCellStyle.setFont(normalFont);
dateCellStyle.setDataFormat(df.getFormat("yyyy"));
setBorder(dateCellStyle);
styles.put("dateCell", dateCellStyle);
//数字格式
CellStyle numberCellStyle = wb.createCellStyle();
numberCellStyle.setFont(normalFont);
numberCellStyle.setDataFormat(df.getFormat("#,##0.00"));
setBorder(numberCellStyle);
styles.put("numberCell", numberCellStyle);
//合计列格式
CellStyle totalStyle = wb.createCellStyle();