Skip to content

区域冻结

清沐 edited this page Oct 6, 2020 · 1 revision

表头冻结

本功能仅针对DefaultExcelBuilder、DefaultStreamExcelBuilder,模板方式天然支持。

使用fixedTitles方法

List<ArtCrowd> dataList = this.getDataList();
Workbook workbook = DefaultExcelBuilder.of(ArtCrowd.class)
                                       .fixedTitles()
                                       .build(dataList);

自定义冻结

DefaultExcelBuilder、DefaultStreamExcelBuilder

使用freezePane方法

List<ArtCrowd> dataList = this.getDataList();
Workbook workbook = DefaultExcelBuilder.of(ArtCrowd.class)
                                       .freezePane(new FreezePane(1,2))// 一行,两列
                                       .build(dataList);

模板

使用freezePanes方法

List<ArtCrowd> dataList = this.getDataList();
Workbook workbook = FreemarkerExcelBuilder.classpathTemplate("test.ftl")
                                       .freezePanes(new FreezePane(1,2))// 一行,两列
                                       .build(dataList);
Clone this wiki locally