合并用Java创建的Excel报表中的单元格

时间:2018-08-24 17:16:43

标签: java excel report enterprise

好吧,我正在尝试在Java中创建一个excel报告,我得到的响应是“ java.lang.IllegalStateException:无法将合并区域A18:B20添加到工作表中,因为它与现有合并区域重叠了(A14:B18 )。”

如果有帮助,请合并单元格的代码:

mergeLines += actSize > 0 ? actSize-1 : 0;

                if(mergeGoal != mergeLines) {
                    includeMergeCell(sheet, mergeGoal, mergeLines, 2, 2, styles.get("no-back-left") );
                    includeMergeCell(sheet, mergeGoal, mergeLines, 3, 3, styles.get("no-back-left") );
                }
            }

          if(mergeSheet < mergeLines){
              sheet.addMergedRegion(new CellRangeAddress(mergeSheet, mergeLines, 0, 1));
          }

0 个答案:

没有答案