POI操作EXCEL合并单元格
依赖
1 2 3 4 5 6 7 8 9 10
| <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进行合并单元格
1 2 3 4
|
CellRangeAddress deviceCellRange = new CellRangeAddress(startRow, startRow + 2, 1, 1); sheet.addMergedRegion(deviceCellRange);
|