背景
导出时如果列超过256导出就会报错,现在进行解决
1、现在的情况
excel文件名以.xls结尾
这个构造函数中默认采取这个类型
this.type = ExcelType.HSSF;
public ExportParams(String title, String sheetName) {
this.color = HSSFColorPredefined.WHITE.getIndex();
this.headerColor = HSSFColorPredefined.SKY_BLUE.getIndex();
this.type = ExcelType.HSSF;
this.style = ExcelExportStylerDefaultImpl.class;
this.headerHeight = 9.0D;
this.isCreateHeadRows = true;
this.isDynamicData = false;
this.isAppendGraph = true;
this.isFixedTitle = true;
this.maxNum = 0;
this.height = 0;
this.title = title;
this.sheetName = sheetName;
}
2、解决办法
文件名以.xlsx结尾
传入构造参数
ExcelType.XSSF
public ExportParams(String title, String sheetName, ExcelType type) {
this.color = HSSFColorPredefined.WHITE.getIndex();
this.headerColor = HSSFColorPredefined.SKY_BLUE.getIndex();
this.type = ExcelType.HSSF;
this.style = ExcelExportStylerDefaultImpl.class;
this.headerHeight = 9.0D;
this.isCreateHeadRows = true;
this.isDynamicData = false;
this.isAppendGraph = true;
this.isFixedTitle = true;
this.maxNum = 0;
this.height = 0;
this.title = title;
this.sheetName = sheetName;
this.type = type;
}