[]
Represents a reference in a formula.
A Reference describes a cell, a range, a worksheet-qualified reference,
a 3D worksheet reference, or a reference to an external workbook. Use its row,
column, range, worksheet, and workbook properties to build or inspect formula
references programmatically.
If a row or column index is relative, use the base row or base column in the parse or unparse context when converting the reference to text.
public sealed class Reference : IEquatable<Reference>, ICloneable
Public NotInheritable Class Reference
Implements IEquatable(Of Reference), ICloneable
FormulaSyntaxTree syntaxTree = FormulaSyntaxTree.Parse("SUM(Sheet1:Sheet3!D4:G10)");
FunctionNode functionNode = (FunctionNode)syntaxTree.Root;
ReferenceNode referenceNode = (ReferenceNode)functionNode.Children[0];
Reference reference = referenceNode.Reference;
reference.LastWorksheetName = null;
Reference addedReference = new Reference();
addedReference.Row = 1;
addedReference.Column = 1;
functionNode.Children.Add(new ReferenceNode(addedReference));
string formulaText = syntaxTree.ToString();
| Name | Description |
|---|---|
| Reference() |
| Name | Description |
|---|---|
| Column | Gets or sets the 0-based column index.
This property stores the column index of the reference. The default value is |
| HasColumn | Gets whether the reference includes a column part.
This property indicates whether the reference contains column information.
The default value is |
| HasRow | Gets whether the reference includes a row part.
This property indicates whether the reference contains row information.
The default value is |
| IsColumnRelative | Gets whether the column part of this reference is relative.
This property indicates whether the column is stored as a relative
reference rather than an absolute one. The default value is |
| IsError | Gets whether the reference contains an error.
The default value is |
| IsLastColumnRelative | Gets whether the last column part of this reference is relative.
For a range reference, this property returns whether the end column is stored as
a relative reference. For a non-range reference, it returns the same value as
IsColumnRelative. The default value is |
| IsLastRowRelative | Gets whether the last row in the reference is relative.
For a range reference, this property indicates whether the ending row is stored as a relative row reference.
For a non-range reference, it returns the same value as IsRowRelative. If the reference
contains an error, this property returns |
| IsRange | Gets whether this reference represents a range.
The default value is |
| IsRowRelative | Gets whether the row part of this reference is relative.
This property indicates whether the row is stored as a relative
reference rather than an absolute one. The default value is |
| LastColumn | Gets or sets the 0-based end column index. For a range reference, this property stores the last column in the range. If the reference is not a range, it returns the same value as Column. If the range does not contain column information, it returns the maximum worksheet column index. |
| LastRow | Gets or sets the 0-based end row index. For a range reference, this property stores the last row in the range. If the reference is not a range, it returns the same value as Row. If the reference is a range that does not contain row information, it returns the maximum row index. |
| LastWorksheetName | Gets or sets the name of the end worksheet of the 3D reference. Use this property together with WorksheetName to inspect or update the worksheet span represented by a 3D reference. |
| Row | Gets or sets the 0-based row index.
This property stores the row index of the reference. The default value is |
| Workbook | Gets or sets the external workbook reference.
Use this property to retrieve or update the workbook component of an external reference,
such as a reference that points to a worksheet in another workbook. The default
value is |
| WorksheetName | Gets or sets the name of the worksheet. Use this property to retrieve or update the start worksheet name associated with this reference. For a 3D reference, use LastWorksheetName to read or update the end worksheet name. |
| Name | Description |
|---|---|
| Clone() | Creates a copy of this reference.
The returned |
| Equals(Reference) | Equality comparison. |
| Equals(object) | Compares this reference with another object.
If |
| GetHashCode() | This object doesn't support getting hash code, because all fields are mutable. |
| ToString() | Converts the reference to text using the specified unparse context. Use UnParseContext to control how the reference is converted, including whether the result uses A1 or R1C1 notation and which base row and base column are applied when relative references are resolved. |
| ToString(UnParseContext) | Converts the reference to text using the specified unparse context. Use UnParseContext to control how the reference is converted, including whether the result uses A1 or R1C1 notation and which base row and base column are applied when relative references are resolved. |