Dear all,
   I was lucky enough to find the solution to the first part of my
question, i.e. how to parse input data to the excel function when it is
fed as an area of cells. So, one needs to cast the Java input argument
of type ValueEval as AreaEvalBase. Here is some example code:

 

@Override
    public ValueEval evaluate(ValueEval[] args, int srcRowIndex, 
int srcColumnIndex) {
       
ValueEval myval = args[0];
AreaEvalBase myarea = (AreaEvalBase) myval;
        
System.out.println("value at (1,0) is = " +
((NumberEval)myarea.getValue(1, 0)).getNumberValue());

return new NumberEval(-1);//just for testing
}


I now just need to know how to export area-type results back to the
spreadsheet. What should the method "evaluate" return?

On Wed, 2012-04-25 at 10:27 +0200, Pantelis Sopasakis wrote:
> Hello list, 
>   This is my first message to the POI developers' list. I had a little 
> problem with overriding excel functions that I partially managed to solve. 
> The function MINVERSE is not implemented on the POI side so I found out that 
> I can register it to FunctionEval as follows:
> 
> FunctionEval.registerFunction("MINVERSE", new Minverse());
> 
> where Minverse is a class implementing the interface "Function" and defines 
> functionality for the method:
> 
> public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int 
> srcColumnIndex)
> 
> there exactly is my question. MINVERSE admits an *area* of cells - not an 
> array. How is this 2-dimensional input passed to the above method. Can I use 
> the input argument of type ValueEval[] to access this area that is passed as 
> input to MINVERSE? And then, how do I output an area back to the Excel 
> spreadsheet?
> 
> Note: I noticed there is an interface called "AreaEval" but I can't figure 
> out how to use it.
> 
> Also I believe it would be good to extend the tutorial at 
> http://poi.apache.org/spreadsheet/user-defined-functions.html to include 
> information on how to implement excel functions that are not supported yet. I 
> would be happy to contribute with an illustrative example.
> 
> Best regards,
> Pantelis Sopasakis
> 
> P.S. I am using POI version 3.8.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
> For additional commands, e-mail: dev-h...@poi.apache.org
> 
> 



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

Reply via email to