]> source.dussan.org Git - poi.git/commitdiff
refactor
authorPJ Fanning <fanningpj@apache.org>
Tue, 17 Oct 2023 10:34:23 +0000 (10:34 +0000)
committerPJ Fanning <fanningpj@apache.org>
Tue, 17 Oct 2023 10:34:23 +0000 (10:34 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1913056 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java

index 8f8e00087dcbde118acdfb8da8a8b7c7aaa78ee7..50e241fddbfc71a8fbe2879c8195658e0c11381b 100644 (file)
@@ -61,7 +61,8 @@ public abstract class BaseXSSFFormulaEvaluator extends BaseFormulaEvaluator {
         try {
             EvaluationCell evalCell = toEvaluationCell(cell);
             eval = _bookEvaluator.evaluate(evalCell);
-            cacheExternalWorkbookCells(evalCell);
+            if (evalCell instanceof XSSFEvaluationCell)
+                cacheExternalWorkbookCells((XSSFEvaluationCell) evalCell);
         } catch (IllegalStateException e) {
             // enhance IllegalStateException which can be
             // thrown somewhere deep down the evaluation
@@ -103,7 +104,7 @@ public abstract class BaseXSSFFormulaEvaluator extends BaseFormulaEvaluator {
      *
      * @param evalCell sourceCell
      */
-    private void cacheExternalWorkbookCells(EvaluationCell evalCell) {
+    private void cacheExternalWorkbookCells(XSSFEvaluationCell evalCell) {
         //
         Ptg[] formulaTokens = getEvaluationWorkbook().getFormulaTokens(evalCell);
         for (Ptg ptg : formulaTokens) {
@@ -112,7 +113,7 @@ public abstract class BaseXSSFFormulaEvaluator extends BaseFormulaEvaluator {
                 if (area3DPxg.getExternalWorkbookNumber() > 0) {
                     EvaluationWorkbook.ExternalSheet externalSheet = getEvaluationWorkbook().getExternalSheet(area3DPxg.getSheetName(), area3DPxg.getLastSheetName(), area3DPxg.getExternalWorkbookNumber());
                     if (externalSheet != null) {
-                        processEvalCell((XSSFEvaluationCell) evalCell, externalSheet, area3DPxg);
+                        processEvalCell(evalCell, externalSheet, area3DPxg);
                     }
                 }