sheet.setColumnWidth(7, 20*255);
sheet.setColumnWidth(8, 10*255);
//创建第一行
XSSFRow row=sheet.createRow(0);
//表头样式
XSSFFont fonttitle=wb.createFont();
fonttitle.setItalic(true);
fonttitle.setFontName("微软雅黑");
fonttitle.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);//粗体
CellStyle styletitle = wb.createCellStyle();
styletitle.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex());
styletitle.setFillPattern(CellStyle.SOLID_FOREGROUND);
styletitle.setFont(fonttitle);
styletitle.setBorderLeft(CellStyle.BORDER_THIN);
styletitle.setBorderRight(CellStyle.BORDER_THIN);
styletitle.setBorderTop(CellStyle.BORDER_THIN);
styletitle.setBorderBottom(CellStyle.BORDER_THIN);
//正文样式
//
XSSFFont fontRed=wb.createFont();
fontRed.setColor(HSSFColor.GREEN.index);
fontRed.setColor(IndexedColors.RED.getIndex());
fontRed.setFontName("微软雅黑");
fontRed.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);//粗体
fontRed.setFontHeightInPoints((short) 11);
CellStyle styleRed = wb.createCellStyle();
styleRed.setFont(fontRed);
styleRed.setBorderLeft(CellStyle.BORDER_THIN);
styleRed.setBorderRight(CellStyle.BORDER_THIN);
styleRed.setBorderTop(CellStyle.BORDER_THIN);
styleRed.setBorderBottom(CellStyle.BORDER_THIN);
XSSFFont fontGreen=wb.createFont();
fontGreen.setColor(IndexedColors.GREEN.getIndex());
fontGreen.setFontName("微软雅黑");
fontGreen.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);//粗体
fontGreen.setFontHeightInPoints((short) 11);
CellStyle styleGreen = wb.createCellStyle();
styleGreen.setFont(fontGreen);
styleGreen.setBorderLeft(CellStyle.BORDER_THIN);
styleGreen.setBorderRight(CellStyle.BORDER_THIN);
styleGreen.setBorderTop(CellStyle.BORDER_THIN);
styleGreen.setBorderBottom(CellStyle.BORDER_THIN);
XSSFFont fontBlack=wb.createFont();
fontBlack.setColor(IndexedColors.BLACK.getIndex());
fontBlack.setFontName("Arial");
fontBlack.setFontHeightInPoints((short) 9);
CellStyle styleBlack = wb.createCellStyle();
styleBlack.setFont(fontBlack);
styleBlack.setBorderLeft(CellStyle.BORDER_THIN);
styleBlack.setBorderRight(CellStyle.BORDER_THIN);
styleBlack.setBorderTop(CellStyle.BORDER_THIN);