On Mon, 22 Sep 2014, Tibu wrote:
We would like to create a UDF, which accesses the cell in which a certain
formula is called and successive cells. (We fill workbooks with data..)
I have tried all day to find a way to do this, but it seems impossible
except this ugly approach:
- Pass the SSWorkbook into the UDF on creation (Because EvaluationWorkbook
does not support getSheetAt())
- Access private field _sheetIndex on OperationEvaluationContext
- Get sheet from SSWorkbook and thus gain access to cell...
Assuming you mean something like "Fetch the values of the next 3 cells
after the one which contains this function", you just do that with the
OperationEvaluationContext and getRefEval
eg for "next 3 cells to the right", just do
ValueEval right1 = ec.getRefEval(ec.getRowIndex(), ec.getColumnIndex()+1);
ValueEval right2 = ec.getRefEval(ec.getRowIndex(), ec.getColumnIndex()+2);
ValueEval right3 = ec.getRefEval(ec.getRowIndex(), ec.getColumnIndex()+3);
Then process those to get the resulting values
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]