完整帮助代码:JAVA poi 帮助类
// 得到一个sheet中有多少个合并单元格 Integer sheetMergeCount = sheet.getNumMergedRegions(); for (Integer i = 0; i < sheetMergeCount; i++) { // 获取合并后的单元格 CellRangeAddress range = sheet.getMergedRegion(i); String cellValue = itemList.get(range.getFirstRow()).get(range.getFirstColumn()); for (Integer mRowIndex = range.getFirstRow(); mRowIndex <= range.getLastRow(); mRowIndex++) { for (Integer mColumnIndex = range.getFirstColumn(); mColumnIndex <= range.getLastColumn(); mColumnIndex++) { itemList.get(mRowIndex).set(mColumnIndex, cellValue); } } }
原文地址:https://www.cnblogs.com/Cailf/p/10024898.html
时间: 2024-10-07 18:44:54