Search in sources :

Example 1 with HeaderDemo2

use of com.hummer.nacos.model.HeaderDemo2 in project hummer-framework by hummer-team.

the class ExcelController method queryUserContext.

@ApiOperation("多标题栏导出")
@GetMapping("/export/table")
public void queryUserContext(HttpServletRequest request, HttpServletResponse response) throws IOException {
    List<TableWriteDataBo> list = new ArrayList<>(2);
    TableWriteDataBo bo = new TableWriteDataBo();
    bo.setHeadClass(HeaderDemo.class);
    bo.setDataInfos(data(1, HeaderDemo.class));
    TableWriteDataBo bo2 = new TableWriteDataBo();
    bo2.setHeadClass(HeaderDemo2.class);
    bo2.setDataInfos(data(5, HeaderDemo2.class));
    bo2.setWithHead(true);
    list.add(bo);
    list.add(bo2);
    String sheet = "table";
    String fileName = "tableWrite_" + System.currentTimeMillis() + ExcelTypeEnum.XLSX.getValue();
    ServletOutputStream os = response.getOutputStream();
    HttpServletResponseUtil.composeExcelResponseHeaders(response, fileName);
    TableWriteTemplate.getInstance().tableWrite(list, sheet, os);
}
Also used : ServletOutputStream(javax.servlet.ServletOutputStream) ArrayList(java.util.ArrayList) HeaderDemo(com.hummer.nacos.model.HeaderDemo) HeaderDemo2(com.hummer.nacos.model.HeaderDemo2) TableWriteDataBo(com.hummer.excel.plugin.model.write.TableWriteDataBo) GetMapping(org.springframework.web.bind.annotation.GetMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

TableWriteDataBo (com.hummer.excel.plugin.model.write.TableWriteDataBo)1 HeaderDemo (com.hummer.nacos.model.HeaderDemo)1 HeaderDemo2 (com.hummer.nacos.model.HeaderDemo2)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ArrayList (java.util.ArrayList)1 ServletOutputStream (javax.servlet.ServletOutputStream)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1