需求
实现报表数据的导入导出,表格中部分数据是系统生成,部分数据是甲方填写,录入系统。
批号唯一
Maven
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.3.2</version>
</dependency>
导出
看到网上都是创建自定义WriteHandler。略麻烦,可以用注解实现。
导出Bean,(bean就不给全了,涉及工艺),合并的单元格是列9,列10
@Data
@ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER,verticalAlignment = VerticalAlignmentEnum.CENTER)
@NoArgsConstructor
@AllArgsConstructor
public class ProductOne {
@ContentLoopMerge(eachRow = 2)
@ExcelProperty(value = {"批号", "批号", "批号", "批号"},index = 0)
@ColumnWidth(20)
private String column1;
@ContentLoopMerge(eachRow = 2)
@ExcelProperty(value = {"API放行标准", "API放行标准", "API放行标准", "API放行标准"},index = 1)
private String column2;
@ContentLoopMerge(eachRow = 2)
@ExcelProperty(value = {"盘库月份", "盘库月份", "盘库月份", "盘库月份"},index = 2)
private String column3;
@ContentLoopMerge(eachRow = 2)
@ExcelProperty(value = {"生产进度", "生产进度", "生产进度", "生产进度"},index = 3)
private String column4;
@ContentLoopMerge(eachRow = 2)
@ExcelProperty(value = {"生产偏差/变更", "生产偏差/变更", "生产偏差/变更", "生产偏差/变更"},index = 4)
private