[]
Creates a new FormulaSyntaxTree from a formula string.
The specified text should contain only the formula expression. It should not
start with = and should not be surrounded with {= }. If
text is null or empty, this method returns an empty
FormulaSyntaxTree.
Use Parse(string, ParseContext) when the formula needs parsing options such as base row, base column, or R1C1 reference style.
public static FormulaSyntaxTree Parse(string text)
Public Shared Function Parse(text As String) As FormulaSyntaxTree
| Type | Name | Description |
|---|---|---|
| string | text | The formula text to parse. This value can be |
| Type | Description |
|---|---|
| FormulaSyntaxTree | A |
string formula = "SUM(A1:A3)+B1";
FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse(formula);
SyntaxNode root = syntaxTree.Root;
Parses formula text into a FormulaSyntaxTree by using the specified ParseContext.
Use the parse context to control how references in the formula text are interpreted, including the zero-based base row, zero-based base column, and whether the formula uses R1C1 reference style.
If text is null or empty, this method returns an empty
FormulaSyntaxTree whose root node is null.
public static FormulaSyntaxTree Parse(string text, ParseContext context)
Public Shared Function Parse(text As String, context As ParseContext) As FormulaSyntaxTree
| Type | Name | Description |
|---|---|---|
| string | text | The formula text to parse. If |
| ParseContext | context | The parse context that specifies the base row, base column, and reference style used to interpret the formula text. |
| Type | Description |
|---|---|
| FormulaSyntaxTree | A |
ParseContext context = new ParseContext();
context.BaseRow = 1;
context.BaseColumn = 4;
context.IsR1C1 = true;
FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("R1C:R3C[1]", context);
SyntaxNode root = syntaxTree.Root;