I want to implement a Excel formula that is CELL function use the Apache POI.

It will return the Current Excel workbook filename when the cell eval 
expression is =CELL("filename").

I could find the cell's sheet from AreaEval type in other eval expression. 
Except the CELL expression that only one argument.

public class CELL implements  Function1Arg, Function2Arg {
    @Override
    public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval 
arg0) {

        return evaluate(srcRowIndex, srcColumnIndex, arg0);
    }

    @Override
    public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval 
arg0, ValueEval arg1) {
        return null; 
    }

    @Override
    public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int 
srcColumnIndex) {
        switch (args.length) {
            case 1:
                return evaluate(srcRowIndex, srcColumnIndex, args[0]);
            case 2:
                return evaluate(srcRowIndex, srcColumnIndex, args[0], args[1]);
        }
        return ErrorEval.VALUE_INVALID;
    }
}
Is there somewhere may let me get the Eval expression's workbook reference?

Reply via email to