|
|
| response.setContentType(;application/vnd.ms-excel;); |
| response.setCharacterEncoding(;utf-8;); |
| |
| response.setHeader(;Content-disposition;, ;attachment;filename=; ; fileName ; ;.xlsx;); |
| |
| WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); |
| contentWriteCellStyle.setBorderLeft(BorderStyle.THIN); |
| contentWriteCellStyle.setBorderTop(BorderStyle.THIN); |
| contentWriteCellStyle.setBorderRight(BorderStyle.THIN); |
| contentWriteCellStyle.setBorderBottom(BorderStyle.THIN); |
| |
| contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER); |
| contentWriteCellStyle.setWrapped(true); |
| |
| WriteCellStyle headWriteCellStyle = new WriteCellStyle(); |
| |
| headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER); |
| |
| HorizontalCellStyleStrategy horizontalCellStyleStrategy = |
| new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle); |
| |
| ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build(); |
| |
| WriteSheet writeSheet = EasyExcel.writerSheet(0, ;日历导出;).head(getHead(calendarExportVO.getTitle())).registerWriteHandler(new SimpleColumnWidthStyleStrategy(19)).registerWriteHandler(horizontalCellStyleStrategy).build(); |
| |
| excelWriter.write(calendarExportVO.getData(), writeSheet); |
| |
| excelWriter.finish(); |
| |