[]
Gets a reference to the FlexGrid calc engine.
public ExcelCalcEngine CalcEngine { get; }
Public ReadOnly Property CalcEngine As ExcelCalcEngine
The CalcEngine responsible for all calculation jobs underlying the FlexSheet. The major jobs are parsing and evaluating the expressions.
This sample showing how to register a custom function to the CalcEngine.
flexSheet.CalcEngine.RegisterFunction("GREATEST", 1, (expressions) =>
{
CellRangeReference rangeReference = (expressions[0] as XObjectExpression).Value as CellRangeReference;
if (rangeReference != null)
{
var enumerator = rangeReference.GetEnumerator();
double greatest = double.MinValue;
while (enumerator.MoveNext())
{
double? v = (enumerator.Current as double?);
if (v.HasValue)
greatest = Math.Max(greatest, v.Value);
}
return greatest;
}
return null;
});