The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

FormulaEngine.Parse(String) Method

Parses the specified formula using the default context.

Namespace: DevExpress.Spreadsheet.Formulas

Assembly: DevExpress.Spreadsheet.v19.1.Core.dll

Declaration

ParsedExpression Parse(string formula)
Function Parse(formula As String) As ParsedExpression
ParsedExpression Parse(string formula)
Function Parse(formula As String) As ParsedExpression

Parameters

Name Type Description
formula String

A string that is the expression to parse. The leading equals "=" symbol is optional.

Parameters

Name Type Description
formula String

A string that is the expression to parse. The leading equals "=" symbol is optional.

Returns

Type Description
ParsedExpression

A ParsedExpression object providing access to the expression tree.

Returns

Type Description
ParsedExpression

A ParsedExpression object providing access to the expression tree.

Remarks

This example demonstrates how to use the FormulaEngine.Parse method to parse an expression and create an expression tree. The expression tree is available by using the ParsedExpression.Expression property.

You can use an expression tree visitor to traverse an existing expression tree and to perform required actions when it visits a specific node. To implement a visitor, create a descendant from the ExpressionVisitor class and override the ExpressionVisitor.Visit method which corresponds to the node type you wish to visit.

In this code snippet, the MyVisitor visitor changes the range reference to shift it down by one row.

After the visitor finishes, the ParsedExpression.ToString method is used to assemble a valid formula from the expression tree.

Public Class MyVisitor
    Inherits DevExpress.Spreadsheet.Formulas.ExpressionVisitor

    Public Overrides Sub Visit(ByVal expression As DevExpress.Spreadsheet.Formulas.CellReferenceExpression)
        MyBase.Visit(expression)

        expression.CellArea.TopRowIndex += 1
        expression.CellArea.BottomRowIndex += 1
    End Sub
End Class
See Also