Class
ExpressionExtensions

Extension methods for RadExpression that provide convenient value extraction, type conversion, and validation operations for use throughout formula evaluation.

Definition

Namespace:Telerik.Windows.Documents.Spreadsheet.Expressions

Assembly:Telerik.Windows.Documents.Spreadsheet.dll

Syntax:

cs-api-definition
public static class ExpressionExtensions

Inheritance: objectExpressionExtensions

Methods

GetValueAsConstantExpression(RadExpression)

Evaluates the expression and returns its value as a constant, extracting the first element if the result is an array.

Declaration

cs-api-definition
public static ConstantExpression GetValueAsConstantExpression(this RadExpression expression)

Parameters

expression

RadExpression

The expression.

Returns

ConstantExpression

The ConstantExpression result.

IntegerValue(RadExpression)

Extracts the integer value from a numeric expression, throwing an exception if the expression is not a NumberExpression.

Declaration

cs-api-definition
public static int IntegerValue(this RadExpression expression)

Parameters

expression

RadExpression

The expression.

Returns

int

The value as integer.

Exceptions

ArgumentNullException

Thrown when expression is not NumberExpression.

IsValidFunctionOrCellReferenceNamePart(char)

Tests whether a character is valid within a function name or cell reference during formula parsing.

Declaration

cs-api-definition
public static bool IsValidFunctionOrCellReferenceNamePart(this char character)

Parameters

character

char

The character.

Returns

bool

True if valid, otherwise false.

NumberValue(RadExpression)

Extracts the numeric value from an expression, returning 0 if the expression is not a NumberExpression.

Declaration

cs-api-definition
public static double NumberValue(this RadExpression expression)

Parameters

expression

RadExpression

The expression.

Returns

double

The number value as double. If the expression is not NumberExpression returns 0.

ToBooleanExpression(bool)

Converts a Boolean value to the corresponding BooleanExpression singleton (True or False).

Declaration

cs-api-definition
public static BooleanExpression ToBooleanExpression(this bool value)

Parameters

value

bool

The value.

Returns

BooleanExpression

The result as BooleanExpression.

ToCellRange(CellReferenceRange)

Converts a CellReferenceRange to the equivalent CellRange with resolved row and column indexes.

Declaration

cs-api-definition
public static CellRange ToCellRange(this CellReferenceRange cellReferenceRange)

Parameters

cellReferenceRange

CellReferenceRange

The cell reference range.

Returns

CellRange

The cell range.