From a1a07dddbce66e01be414ee8a882ab353f00a4e4 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 14 Sep 2021 14:42:08 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-59440=20=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E3=80=91=E5=90=88=E5=B9=B6=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E4=BB=A5=E5=90=8E=EF=BC=8C=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=83=BD=E5=8F=98=E6=88=90=E4=BA=86=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 合并时新建单元格需要在设计器模块中处理,已获取当前正在编辑模版的主题数据来设置样式 【改动思路】 同标题 --- .../com/fr/grid/selection/CellSelection.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java index 23dbc77f5..7a23a1396 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java @@ -383,8 +383,27 @@ public class CellSelection extends Selection { return false; } } - - ec.merge(row, row + rowSpan - 1, column, column + columnSpan - 1); + int rowStartIndex = row; + int rowEndIndex = row + rowSpan - 1; + int columnStartIndex = column; + int columnEndIndex = column + columnSpan - 1; + + // 合并已有单元格,还是新建单元格 + boolean hasCellElement = false; + for (int ri = rowStartIndex; ri <= rowEndIndex; ri++) { + for (int ci = columnStartIndex; ci <= columnEndIndex; ci++) { + CellElement ce = ec.getCellElement(ci, ri); + if (ce != null) { + hasCellElement = true; + break; + } + } + } + if (hasCellElement) { + ec.merge(row, row + rowSpan - 1, column, column + columnSpan - 1); + } else { + ec.addCellElement(DefaultThemedTemplateCellElementCase.createInstance(column, row, columnSpan, rowSpan, null), true); + } return true; }