Skip to content

Use the FormulaEngine class to evaluate worksheet formulas and parse expressions.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/winforms-spreadsheet-use-formula-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spreadsheet for WinForms - Use Formula Engine

This example demonstrates how to use the FormulaEngine class to evaluate worksheet formulas and parse expressions.

Implementation Details

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 the the FormulaEngine.Evaluate method call 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.

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

About

Use the FormulaEngine class to evaluate worksheet formulas and parse expressions.

Topics

Resources

License

Stars

Watchers

Forks