[]
Loads a SyntaxNode from a string that contains a formula.
This method calls Parse(string, ParseContext) with the default parse context.
public static SyntaxNode Parse(string text)
Public Shared Function Parse(text As String) As SyntaxNode
| Type | Name | Description |
|---|---|---|
| string | text | A string that contains the formula to parse. This value can be |
| Type | Description |
|---|---|
| SyntaxNode | A |
SyntaxNode node = SyntaxNode.Parse("SUM(A1:A3)+B1");
string formulaText = node.ToString();
| Type | Condition |
|---|---|
| ArgumentException | if |
Loads a SyntaxNode from a formula string using the specified ParseContext.
Use the parse context to control how references in the formula are interpreted, including the 0-based base row, 0-based base column, and whether the formula uses R1C1 reference style.
If text is null or empty, this method returns the singleton
empty node. If the formula text is invalid, this method throws an
ArgumentException.
public static SyntaxNode Parse(string text, ParseContext context)
Public Shared Function Parse(text As String, context As ParseContext) As SyntaxNode
| Type | Name | Description |
|---|---|---|
| string | text | The formula text to parse. If |
| ParseContext | context | The parse context that specifies the base row, base column, and whether the formula uses R1C1 reference style. |
| Type | Description |
|---|---|
| SyntaxNode | A SyntaxNode populated from the specified formula text, or the empty node if |
ParseContext context = new ParseContext();
context.BaseRow = 1;
context.BaseColumn = 7;
context.IsR1C1 = true;
SyntaxNode node = SyntaxNode.Parse("R1C:R8C[4]*9", context);
string formula = node.ToString();
| Type | Condition |
|---|---|
| ArgumentException | if |