Thanks Niklas & Eike. So if I have understood correctly, I need to add my operation to the list of functions (add,max etc.) so that when I call the ScFormulaCell::Interpret, the formula gets evaluated according to my function. But that requires an opcode, which I will have to generate ? Also, my formula follows a different grammar !!
What If I evalute my formula in a separate function rather than call interpret and just return the answer in a matrix. How do I then print the matrix ? This is tough work. Appreciate all your help !! Rashi On Wed, Jul 7, 2010 at 4:31 PM, Eike Rathke <e...@sun.com> wrote > > The ScInterpreter ctor needs a ScFormulaCell anyway, calling > ScFormulaCell::Interpret() takes care of that. Then use > ScFormulaCell::GetErrCode() to check for error. As it seems you're > expecting a matrix result you may then use ScFormulaCell::GetMatrix(), > note that if the result was not a matrix a NULL pointer is returned and > depending on IsValue() you may use GetValue() or GetString() to obtain > the result. > > You'll have to create the ScFormulaCell instance with the ctor that > takes a preconstructed ScTokenArray* and a BYTE as last parameter and > pass the MM_FORMULA constant there, otherwise the matrix result would be > thrown away and only the top left value survived as cell result. > > >