c# - How can I parse an excel formula? -


i converting functionalities incorporated in complex excel sheet asp.net project. in have requirement parse/process excel formula using vb.net or c#.

i have grid structure displays accounting figures , user allowed pre-configure formula in required cells.

example :- in datagrid cell[2][1], should able configure

formula = sum(cell[1][1] + cell[1][2]) .

is there way can parse/process excel formula vb.net/c# ?

you work around flee library evaluate c# expressions

// create calculation engine calculationengine engine = new calculationengine(); expressioncontext context = new expressioncontext(); variablecollection variables = context.variables;  // add variables variables.add("x", 100);             variables.add("y", 200);  // add expression calculation engine "a" engine.add("a", "x * 2", context);  // add expression engine "b" engine.add("b", "y + 100", context);  // add expression @ "c" uses results of "a" , "b" engine.add("c", "a + b", context);  // value of "c" int result = engine.getresult<int>("c");  // update variable on "a" expression             variables["x"] = 200;  // recalculate engine.recalculate("a");  // updated result result = engine.getresult<int>("c"); 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -