Hi,
I have already posted this question to
http://stackoverflow.com/questions/13195020/is-it-possible-to-get-the-operands-from-a-funcvarptg-in-apache-poi.
As there was not much of a response I was pointed to the mailing list:
I want to compute a slice (http://en.wikipedia.org/wiki/Program_slicing)
of an Excel Spreadsheet starting from some cell. That means I need to
find out what cells are referenced in a cell and recursively follow
those references. So far so good.
Now I ran into a problem with if statements (and I assume other more
complex statements too) in that I get a Ptg of type FuncVarPtg, for
which I don't know how to get the operands and the references contained
in them.
FormulaParser.parse("IF(C2>D2,A1,B1)") yields the cells referenced in
the if condition, but not the ones in the then and else branches. Here
is some exemplary output (cell C2 holds value 1.0 and cell D2 holds 0.0,
i.e. these references are resolved and followed without a problem using
RefPtg.getRow() and RefPtg.getColumn())
fromCell IF(C2>D2,A1,B1)
ptg org.apache.poi.ss.formula.ptg.RefPtg [C2]
fromCell 1.0
ptg org.apache.poi.ss.formula.ptg.RefPtg [D2]
fromCell 0.0
ptg org.apache.poi.ss.formula.ptg.FuncVarPtg [IF nArgs=3]
My question in short: Is there a way to get the referenced operands out
of a FuncVarPtg?
Best regards,
Matthias
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]