https://issues.apache.org/bugzilla/show_bug.cgi?id=47845
Summary: Cross-workbook name references evaluate to NameXEval
Product: POI
Version: 3.5-dev
Platform: All
OS/Version: Mac OS X 10.4
Status: NEW
Severity: major
Priority: P2
Component: HSSF
AssignedTo: [email protected]
ReportedBy: [email protected]
Created an attachment (id=24270)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=24270)
reproduction of the bug
I have multiple workbooks and am referencing names from one workbook in a
second workbook. When evaluating formulas containing one of these cross
workbook name references using ForkedEvaluator I get the exception below.
I have reproduced the problem in the attached example. Book1.xls and Book2.xls
each have one sheet (Sheet1) with one cell (A1). Book1.xls has the name
"MyCell" which references "Sheet1!A1". [Book1.xls]Sheet1!A1 contains the
constant 100 and [Book2.xls]Sheet1!A1 contains the formula "=[Book1.xls]MyCell
+ 1" and thus should evaluate to 101 but instead yields an exception.
Note that if I take out the "+1" in the formula I no longer get the exception
but the result is a NameXEval object (not the expected NumberEval).
Note also if I rewrite the formula as "[Book1.xls]Sheet1!A1 + 1" it works. But
I would like to use the named references.
Paul
Exception in thread "main" java.lang.RuntimeException: Unexpected arg eval type
(org.apache.poi.hssf.record.formula.eval.NameXEval)
at
org.apache.poi.hssf.record.formula.eval.OperandResolver.coerceValueToDouble(OperandResolver.java:221)
at
org.apache.poi.hssf.record.formula.eval.TwoOperandNumericOperation.singleOperandEvaluate(TwoOperandNumericOperation.java:27)
at
org.apache.poi.hssf.record.formula.eval.TwoOperandNumericOperation.evaluate(TwoOperandNumericOperation.java:33)
at
org.apache.poi.ss.formula.WorkbookEvaluator.invokeOperation(WorkbookEvaluator.java:398)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:333)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:216)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:180)
at
org.apache.poi.ss.formula.eval.forked.ForkedEvaluator.evaluate(ForkedEvaluator.java:109)
at mypackage.poi.PoiBug.main(PoiBug.java:32)
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]