使用 EasyExcel 导出 Excel 时,可以使用 com.alibaba.excel.metadata.TableStyle 来设置表头冻结:

TableStyle tableStyle = new TableStyle();
// 冻结表头
tableStyle.setFreezeFirstRow(true);
// 设置表头样式
tableStyle.setTableHeadBackGroundColor(IndexedColors.AQUA);
// 设置表格样式
Table table = new Table(1);
table.setTableStyle(tableStyle);

// 将表格添加到 sheet 中
sheet.setTable(table);
EasyExcel 导出 Excel 如何冻结表头

原文地址: https://www.cveoy.top/t/topic/ljHA 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录