CellRangeAddress和并单元格的类,templateSheet.getMergedRegions()获取excel合并的单元格。参考以下代码
List<CellRangeAddress> cellRangeAddressList = templateSheet.getMergedRegions();
// 加入合并单元格信息
for (CellRangeAddress cra : adjustedRangeAddress) {
try {
targetSheet.addMergedRegion(cra);
} catch (Exception e) {
}
}