Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

Formula Engine - examples of use

$
0
0
This example demonstrates how to use the FormulaEngine class for evaluating worksheet formulas and parsing expressions.
Select a cell and click the Set Context Cell button to specify a cell used to create the ExpressionContext  object. The context cell is highlighted with blue color.
Click Evaluate Predefined Formula to calculate a simple formula SUM(R[-2]C:R[-1]C) by calling the FormulaEngine.Evaluate method with the specified context.
Click Parse and Modify Active Cell Formula to call the FormulaEngine.Parse  method and create an expression tree from the active cell formula. Subsequently a custom Visitor object is used to traverse the tree and increment row indexes which define an area referenced in the formula.
The Switch R1C1 button can be used to change worksheet reference style if required to correctly interpret formula references.
To calculate formula contained in the active cell using different ExpressionStyle settings, click Evaluate Cell Formula. When executed for the ROW(R2:R11) formula, the Normal expression style setting returns 1, the first row number, and the Array expression style returns an array of row numbers.

Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>