use of com.hccake.common.excel.annotation.Sheet in project ballcat by ballcat-projects.
the class ManySheetWriteHandler method write.
@Override
public void write(Object obj, HttpServletResponse response, ResponseExcel responseExcel) {
List<?> objList = (List<?>) obj;
ExcelWriter excelWriter = getExcelWriter(response, responseExcel);
Sheet[] sheets = responseExcel.sheets();
WriteSheet sheet;
for (int i = 0; i < sheets.length; i++) {
List<?> eleList = (List<?>) objList.get(i);
Class<?> dataClass = eleList.get(0).getClass();
// 创建sheet
sheet = this.sheet(sheets[i], dataClass, responseExcel.template(), responseExcel.headGenerator());
// 写入sheet
excelWriter.write(eleList, sheet);
}
excelWriter.finish();
}
Aggregations