1. 修改ExcelExportOfTemplateUtil中的方法(直接调用报Sheet index (0) is out of range (0…0)异常)
/**
* 此方法被修改
*/
public Workbook createExcelByTemplate (TemplateExportParams params,
Map<Integer, Map<String, Object>> map) {
// step 1. 判断模板的地址
if (params == null || map == null || StringUtils.isEmpty (params.getTemplateUrl ())) {
throw new ExcelExportException (ExcelExportEnum.PARAMETER_ERROR);
}
Workbook wb = null;
// step 2. 判断模板的Excel类型,解析模板
try {
this.teplateParams = params;
wb = getCloneWorkBook ();
// 创建表格样式
setExcelExportStyler ((IExcelExportStyler) teplateParams.getStyle ()
.getConstructor (Workbook.class).newInstance (wb));
// step 3. 解析模板
for (int i = 0, le = params.isScanAllsheet () ? wb.getNumberOfSheets ()
: params.getSheetNum ().length