From b951fe136282302620a55864afe8146f6de8969f Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 25 Nov 2024 17:52:57 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-141452=20=E3=80=90=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E6=9B=BF=E6=8D=A2=E3=80=91=E5=AD=98=E5=82=A8=E8=BF=87?= =?UTF-8?q?=E7=A8=8B=E7=9A=84=E6=95=B0=E6=8D=AE=E9=9B=86=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/replace/utils/ReplaceUtils.java | 38 +++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java index 1230433459..6d03f648cb 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java @@ -63,6 +63,7 @@ import com.fr.report.utils.ElementCaseHelper; import com.fr.stable.StringUtils; import java.util.ArrayList; +import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -127,13 +128,7 @@ public class ReplaceUtils { Set ans = new HashSet<>(); FormElementCaseProvider provider = elementCaseEditor.getElementCase(); if (provider instanceof ElementCase) { - // 非公式部分 - ans.addAll(searchTableDataWithOutFormula((ElementCase)provider)); - // 公式部分——理论上就只有单元格和控件(超链那些都包含) - List formulaInfos = getElementCaseFormulas((ElementCase) provider); - ans.addAll(searchFormulaInfos(formulaInfos)); - // 超链部分 - ans.addAll(searchElementCasJs((ElementCase)provider)); + ans.addAll(searchElementCaseDependenceTables((ElementCase) provider)); } return ans; } @@ -168,10 +163,10 @@ public class ReplaceUtils { String tableName = iterator.next(); ans.add(tableName); } + ans.addAll(searchReport(workBook)); } return ans; } - /** * 获取CPT里使用的公式 * @@ -860,5 +855,32 @@ public class ReplaceUtils { return ans; } + private static Set searchReport(WorkBook workBook) { + Set ans = new HashSet<>(); + for (int i = 0; i < workBook.getReportCount(); i++) { + Report report = workBook.getReport(i); + if (report != null) { + Iterator it = report.iteratorOfElementCase(); + while (it.hasNext()) { + ElementCase elementCase = (ElementCase) it.next(); + ans.addAll(searchElementCaseDependenceTables(elementCase)); + } + } + } + return ans; + } + + + private static Collection searchElementCaseDependenceTables(ElementCase provider) { + Set ans = new HashSet<>(); + // 非公式部分 + ans.addAll(searchTableDataWithOutFormula(provider)); + // 公式部分——理论上就只有单元格和控件(超链那些都包含) + List formulaInfos = getElementCaseFormulas( provider); + ans.addAll(searchFormulaInfos(formulaInfos)); + // 超链部分 + ans.addAll(searchElementCasJs(provider)); + return ans; + } }