Excel Like Calculations Without Excel
Essential Calculate lets you add calculation support to objects by implementing an ICalcData interface. CalcQuick and CalcDataGrid both implement ICalcData, which gives them their calculation support.
ICalcData is designed around a rectangular array of data, but this rectangular design can be hidden as seen in CalcQuick.
Here is a simple application of this concept:
When using Excel to design a workbook with a series of spreadsheets to calculate values based on inputs; using inputs like age, gender, state, and car model, you could have a workbook that does a series of lookups and then produces how much insuring a car may cost an individual.
You could use Essential Calculate plus Essential XlsIO to read this workbook, accept a series of inputs, and output a series of results all on a machine that does not host Excel.
Excel Workbook Car Insurance Sample
Form Interface to Workbook
This form can access the .xls file, thus allowing you to perform calculations, even when you don't have Excel on the system.
Essential Calculate lets you add calculation support to objects by implementing an interface, ICalcData.
CalcQuick and CalcDataGrid both implement ICalcData, which gives them their calculation support.
ICalcData is designed around a rectangular array of data. This rectangular design can be hidden, just as in CalcQuick.
There are four members of the ICalcData interface, three methods and one event.
ICalcData Interface
Two of the methods are used to get and set values, one method gives you access to the object after it has been created, and the event is used to notify listeners when values change.
Use CalcQuick to add calculation support to just about anything. You can register values or formulas using an indexer on the CalcQuick object.
Following this, the act of retrieving a value through the CalcQuick indexing triggers the calculation.
A single command can add calculation support to a collection of text box and combo box controls.
The following code sample allows you to enter a value in one text box and automatically display the computed values in other text boxes.
Specifying Related Controls
Properties let you control whether changes to values tracked by a CalcEngine object automatically trigger dependent calculations.
Turning off this auto-calculation support lets you quickly change many values and then do the calculation only when all updates are completed.
The CalcDataGrid class enables support for calculations on a Windows Forms data grid.
It allows you to use Excel-like formulas to calculate values that depend on other cells' values.
Essential Calculate can manage multiple data-bound grid objects. You can also have have formulas with reference values from one grid in another grid.
Essential Calculate also provides support for sheet ranges. Setting the CalcEngine.SupportsSheetRanges property to True makes the engine support sheet ranges such as "=SUM(Sheet1:Sheet3!A1)" and "=SUM(Sheet1:Sheet3!A1:B4)".
You can add functions by writing a method that defines the calculation and registering a delegate for this method with Essential Calculate.
The class library has helper methods that can be used to retrieve lists of values and compute formulas, if needed, to manage custom functions.
Helper methods can also be directly accessed to parse and compute formulas for use in code.
Essential Calculate contains a library of more than 150 functions ready for your use.
The functions used range from standard mathematical functions such as cosine and sine, to statistical functions like averages and standard deviations, and even financial functions (declining balance and future value, for example).
Underlying Mathematics
Underlying Mathematics