This sample illustrates the use of multiple sheet references and named ranges along with the GridFormulaEngine. Named ranges allow the user to set up names for expressions or ranges and use these names in the formulas. For example, users can name the range B4:B12 as Expenses and then use formulas like =Sum(Expenses) instead of =Sum(B4:B12).
Features
Multiple Sheet References
For multiple or cross sheet references, call the static method RegisterGridAsSheet of the GridFormulaEngine class, and pass the parameters - sheet name, grid model, and sheet family ID.
Sheet family ID is an integer which is returned on calling the static method CreateSheetFamilyID of the GridFormulaEngine class.
To employ formula cells to the entire grid, set TableStyle.CellType property to FormulaCell and Format property to ‘F2’ in order to have cell values with two decimal places.
Named Range Support
Instantiate GridFormulaEngine class through any one of the grids registered under the same sheet family id.
Call the AddNamedRange function using an instance of GridFormulaEngine class and pass name of the range and value for which this name has to be set, as parameters.
ShowNamedRangesDialog method displays the Collection Editor dialog box for editing the named ranges.
The title of the Collection Editor can be changed by handling the ShowingNamedRangesDialog event.