EasyExcel自定义复杂表头生成

news/2024/10/22 8:32:31/
 private List<List<String>> getHeader(List<ProductCategory> categories) {final String mainHead = LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy年MM月dd日") + "XXX";List<String> head1 = new ArrayList<>();head1.add(mainHead);head1.add("区域");List<String> head2 = new ArrayList<>();head2.add(mainHead);head2.add("序号");List<String> head3 = new ArrayList<>();head3.add(mainHead);head3.add("用户");List<String> head4 = new ArrayList<>();head4.add(mainHead);head4.add("具体 ");List<List<String>> resHead = new ArrayList<>();resHead.add(head1);resHead.add(head2);resHead.add(head3);resHead.add(head4);for (int i = 1; i < 9; i++) {List<String> head5 = new ArrayList<>();head5.add(mainHead);head5.add("明细");head5.add(i);resHead.add(head5);}return resHead;}

使用

//表头List<List<String>> header = this.getHeader(categories);      //写入表头EasyExcel.write(outputStream).head(header).sheet().doWrite(dataList);}

效果图


http://www.ppmy.cn/news/429800.html

相关文章

EasyExcel 中文文档

官方文档&#xff1a;https://alibaba-easyexcel.github.io/index.html 停更 最新文档&#xff1a;https://www.yuque.com/easyexcel/doc/easyexcel 注&#xff1a;EasyExcel目前只适合简单的数据导入导出&#xff0c;不支持图片读取。 官方API 读Excel DEMO代码地址 写…

怎么用手机迅速编辑表格?

虽然手机已经足够智能&#xff0c;但与电脑相比在工作上仍然存在较大的局限&#xff0c;例如在制作表格时&#xff0c;我们习惯用大量的快捷键进行便捷操作&#xff0c;显然在手机上是无法实现的。那么怎么用手机迅速编辑表格呢&#xff1f;云电脑了解一下~ ​既然无法在手机上…

LayUI表格在线编辑动态修改列数据

LayUI表格在线编辑动态修改列数据 每次只能修改指定属性是 edit 定义的 列 {field:aname, width:80, title: 昵称, minWidth: 100, edit: text, algin : center,templet : function( res ){ return res.aname "null" ? 未知 : res.aname; }}点击列修改数据 …

EasyExcel个性化表头

实现SheetWriteHandler package cn.hsa.tps.rupu.Listener;import com.alibaba.excel.write.handler.SheetWriteHandler; import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder; import or…

【工具】Excel表格数据不能编辑

excel文件打开之后不能编辑表格数据&#xff0c;大部分原因是因为工作表设置了保护&#xff0c;在工具栏中找到【审阅】-【撤销工作表保护】&#xff0c;输入excel密码&#xff0c;将保护工作表取消就可以了。 不知道excel密码的同学&#xff0c;可以使用工具帮助我们解决问题…

开发技术-easyexcel生成表格

目录 1.pom配置 2.创建实体类 3.创建工具类 4.业务处理 5.postman测试 1.pom配置 <dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.1.0</version></dependency><…

增删改查表格(好看且有趣)

演示地址&#xff1a;https://codepen.io/kissbackboard/pen/oNExNKL 目前实现了增删改查、排序、趣味提示信息、回收站。 右边的猫头鹰是使用Spline3D设计工具制作&#xff0c;我拿官方模型库里的加工了一下 HTML: <!DOCTYPE html> <html lang"en">&…

易语言excel内容查找助手

易语言excel内容查找助手 工具介绍 由于同事需要&#xff0c;公司要求需要我开发一个小excel搜索小工具并且具有能导出另存为excel的功能&#xff0c;然后就有了这个工具。 软件使用说明&#xff1a; 本软件主要把xls得excel文件导入到软件列表&#xff0c;通过列表搜索结果…