use of com.github.liaochong.myexcel.core.parser.Table in project myexcel by liaochong.
the class HtmlToExcelFactory method buildTablesWithMultiSheet.
/**
* MultiSheet 策略
*
* @param tables tables
*/
private void buildTablesWithMultiSheet(List<Table> tables) {
for (int i = 0, size = tables.size(); i < size; i++) {
Table table = tables.get(i);
String sheetName = this.getRealSheetName(table.caption);
Sheet sheet = workbook.getSheet(sheetName);
if (sheet == null) {
sheet = workbook.createSheet(sheetName);
}
boolean hasTd = table.trList.stream().map(tr -> tr.tdList).anyMatch(list -> !list.isEmpty());
if (!hasTd) {
continue;
}
// 设置单元格样式
this.setTdOfTable(table, sheet);
this.freezePane(i, sheet);
// 移除table
tables.set(i, null);
}
}
Aggregations