FormulaEngine Class

Headless Excel-compatible formula engine. Use Formula for one-shot stateless evaluation, or instantiate FormulaEngine for a stateful mini-spreadsheet that recalculates dependents on change. Formula syntax matches Excel — leading = optional. Supports the full function library registered with the engine plus operators, ranges (=SUM(A1:A10)), and built-in functions (SUM, AVERAGE, IF, VLOOKUP, …).

Inheritance

Object

Documents.Spreadsheet.FormulaEngine

Namespace: Radzen.Documents.Spreadsheet

Assembly: Radzen.Blazor.dll

Syntax

public sealed class FormulaEngine

Constructors

FormulaEnginelink

Creates a new engine with an internal worksheet sized to Excel's limits (1,048,576 rows × 16,384 columns).

Declaration
public FormulaEngine()

Properties

Functionslink

The function registry. Use Functions.Add<YourFormulaFunction>() to extend the formula library with custom functions.

Declaration
public Documents.Spreadsheet.FunctionStore Functions { get; }
Property Value
Type Description
Documents.Spreadsheet.FunctionStoreThe function registry. Use Functions.Add<YourFormulaFunction>() to extend the formula library with custom functions.

Methods

Evaluatelink

Evaluates an ad-hoc expression against the current engine state, returning the result without writing to any cell.

Declaration
public object Evaluate(string expression)
Parameters
Type Name Description
string expression
Returns
Type Description
object

Getlink

Reads a cell's current value. For formula cells, returns the cached evaluated result.

Declaration
public object Get(string cellRef)
Parameters
Type Name Description
string cellRef
Returns
Type Description
object

Setlink

Sets a cell's value or formula. A string starting with = is treated as a formula; everything else is parsed as a literal (numbers, dates, booleans, text). Dependent formulas already in the engine recalculate automatically.

Declaration
public void Set(string cellRef, object value)
Parameters
Type Name Description
string cellRef
object value
An error has occurred. This app may no longer respond until reloaded. Reload 🗙