Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

ExcelFormulaSyntaxTree

OfficeIMO.Excel

Namespace
OfficeIMO.Excel
Assembly
OfficeIMO.Excel
Source revision
e163ccb36643 with working tree changes
Modifiers
sealed

Immutable syntax tree for reference-bearing Excel formula text. It preserves all non-reference tokens verbatim and provides the common rewriter used by public conversion and search APIs.

Inheritance

  • object
  • ExcelFormulaSyntaxTree

Usage

Explore 2 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 2

Methods

public string ConvertReferences(ExcelReferenceStyle outputStyle, int anchorRow = 1, int anchorColumn = 1) #

Converts every parsed reference to A1 or R1C1 notation.

Parameters

outputStyle OfficeIMO.Excel.ExcelReferenceStyle required
anchorRow int = 1 optional
anchorColumn int = 1 optional

Returns

string
Parse 2 overloads
public static ExcelFormulaSyntaxTree Parse(string formula) #

Parses A1 formula references while preserving all other tokens verbatim.

Parameters

formula string required
public static ExcelFormulaSyntaxTree Parse(string formula, ExcelReferenceStyle inputStyle, int anchorRow = 1, int anchorColumn = 1) #

Parses references in the selected notation, resolving relative R1C1 coordinates at the supplied cell.

Parameters

formula string required
inputStyle OfficeIMO.Excel.ExcelReferenceStyle required
anchorRow int = 1 optional
anchorColumn int = 1 optional
public string Rewrite(Func<ExcelReference, ExcelReference?> rewriter, ExcelReferenceStyle outputStyle = A1, int anchorRow = 1, int anchorColumn = 1) #

Rewrites reference nodes once while preserving literals and all other syntax.

Parameters

rewriter System.Func<OfficeIMO.Excel.ExcelReference, OfficeIMO.Excel.ExcelReference?> required
outputStyle OfficeIMO.Excel.ExcelReferenceStyle = A1 optional
anchorRow int = 1 optional
anchorColumn int = 1 optional

Returns

string
public string RewriteNames(Func<string, string?> rewriter) #

Rewrites defined-name nodes while preserving all other formula syntax.

Parameters

rewriter System.Func<string, string?> required

Returns

string
public string RewriteStructuredReferences(Func<string?, string, string?> rewriter) #

Rewrites structured table-reference nodes while preserving all other formula syntax.

Parameters

rewriter System.Func<string?, string, string?> required

Returns

string
public string RewriteTableNames(Func<string, string?> rewriter) #

Rewrites table identifiers in structured and bare table-reference nodes.

Parameters

rewriter System.Func<string, string?> required

Returns

string

Properties

public string Text { get; } #

Exact authored formula text.

public IReadOnlyList<ExcelFormulaSyntaxNode> Nodes { get; } #

Ordered syntax nodes preserving the authored formula.