aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/ss
diff options
context:
space:
mode:
authorGreg Woolsey <gwoolsey@apache.org>2019-03-30 18:14:14 +0000
committerGreg Woolsey <gwoolsey@apache.org>2019-03-30 18:14:14 +0000
commit30851e44a60a2a9f377eb2f0c938c35bb9fd8f0a (patch)
treeec65177f786d075c2b4858330813e3f34d3be798 /src/java/org/apache/poi/ss
parent2a9390d683e26b066c42ae1f91e9fbf4034284e1 (diff)
downloadpoi-30851e44a60a2a9f377eb2f0c938c35bb9fd8f0a.tar.gz
poi-30851e44a60a2a9f377eb2f0c938c35bb9fd8f0a.zip
#63302 Formula evaluation of names with offset or row function is incorrect
thanks to John Lincoln White for the patch, including new unit tests. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1856644 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/ss')
-rw-r--r--src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java b/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
index 2116456f34..060f274ef0 100644
--- a/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
+++ b/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
@@ -773,10 +773,12 @@ public final class WorkbookEvaluator {
* YK: Used by OperationEvaluationContext to resolve indirect names.
*/
/*package*/ ValueEval evaluateNameFormula(Ptg[] ptgs, OperationEvaluationContext ec) {
- if (ptgs.length == 1) {
- return getEvalForPtg(ptgs[0], ec);
- }
- return evaluateFormula(ec, ptgs);
+ if (ptgs.length == 1 && !(ptgs[0] instanceof FuncVarPtg)) {
+ return getEvalForPtg(ptgs[0], ec);
+ }
+
+ OperationEvaluationContext anyValueContext = new OperationEvaluationContext(this, ec.getWorkbook(), ec.getSheetIndex(), ec.getRowIndex(), ec.getColumnIndex(), new EvaluationTracker(_cache), false);
+ return evaluateFormula(anyValueContext, ptgs);
}
/**