poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yegor Kozlov <yegor.koz...@dinom.ru>
Subject Re: Custom Excel Functions
Date Wed, 25 Apr 2012 09:33:59 GMT
The array of ValueEval args contains all arguments passed to the
function. If in Excel you pass N arguments, e.g. FUNC(arg1, arg2,
arg3, ...., argN)
then on the POI side the function takes it as a array of ValueEvals :
{ve1, ve2, ve3, ...veN} where ve1 - ven are instances of the ValueEval

MINVERSE takes one argument so your code will receive a 1-length array
 of ValueEvals.

The concrete type of ValueEval depends on what you pass in Excel:
range, array or reference.
In you code you should check the actual type with instanceof:

case 1: passing a 2D area, e.g. MINVERSE(A1:C5)

if( args[0]instanceof TwoDEval){
  TwoDEval area = (TwoDEval )arg;

case 2: passing a reference to a 2D area, e.g. MINVERSE(A2)  where A2
is a reference to B2: C5

else if( args[0]instanceof RefEval){

case 3: passing a array, e.g.  MINVERSE({1,2,3;4,5,6;7,8,9})
Unfortunately arrays are not yet supported. This means that the syntax
like will not work and POI will throw a exception.

> And then, how do I output an area back to the Excel spreadsheet?

What is the calculation result? If it is a number then return
NumberEval. If it is a range then return AreaEval.
If the result is a array then POI cannot handle it. Array evals are
not yet supported.


To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message