Table of Contents

Class NoxFormula

Namespace
Nox.Grid
Assembly
Nox.Grid.dll

A cell formula (Excel syntax). A1 refers to the first data row and first column. Examples: =SUM(A1:A10), =B2*C2, =IF(D2>=60,"Pass","Fail"), another sheet: =Sheet2!A1.

public sealed class NoxFormula
Inheritance
NoxFormula
Inherited Members

Properties

FunctionNames

Available function names (built-in plus registered functions).

public static IReadOnlyCollection<string> FunctionNames { get; }

Property Value

IReadOnlyCollection<string>

Text

Formula text (without '='). References are adjusted when rows are inserted or deleted.

public string Text { get; }

Property Value

string

Methods

Clone()

Returns a copy of this formula.

public NoxFormula Clone()

Returns

NoxFormula

IsFunctionDefined(string)

Whether a function with this name exists (built in or registered).

public static bool IsFunctionDefined(string name)

Parameters

name string

Returns

bool

Parse(string)

Parses a formula (the leading "=" is optional). Throws NoxFormulaException on a syntax error.

public static NoxFormula Parse(string formula)

Parameters

formula string

Returns

NoxFormula

RegisterFunction(string, Func<object[], object>)

Registers a user function. Arguments are passed as an array of evaluated values; range arguments are two-dimensional arrays (object(,)). Blank cells are Nothing (null). An existing function with the same name is replaced. Built-in function names cannot be used.

public static void RegisterFunction(string name, Func<object[], object> function)

Parameters

name string
function Func<object[], object>

ToString()

The formula prefixed with "=".

public override string ToString()

Returns

string

TryParse(string, out NoxFormula)

Parses a formula without throwing. Returns False (and result Nothing) when the text is not a valid formula.

public static bool TryParse(string formula, out NoxFormula result)

Parameters

formula string
result NoxFormula

Returns

bool

UnregisterFunction(string)

Removes a function added with RegisterFunction. Returns False if no such function was registered.

public static bool UnregisterFunction(string name)

Parameters

name string

Returns

bool