系列文章目录
POI操作EXCEL合并单元格
原文链接 https://zhhll.icu/2023/第三方工具/POI/2.POI操作EXCEL合并单元格/
依赖
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
使用CellRangeAddress进行合并单元格
// 合并单元格
// 参数列表含义分别为 起始行、终止行、起始列、终止列
CellRangeAddress deviceCellRange = new CellRangeAddress(startRow, startRow + 2, 1, 1);
sheet.addMergedRegion(deviceCellRange);