CellRef Struct

Represents a reference to a cell in A1 notation e.g. "A1", "B2", etc. The row and column are zero-based indices, so "A1" corresponds to (0, 0) and "B2" corresponds to (1, 1). This struct is immutable and provides methods for parsing, comparing, and converting to string representation.

Namespace: Radzen.Documents.Spreadsheet

Assembly: Radzen.Blazor.dll

Syntax

public struct CellRef

Constructors

CellReflink

Represents a reference to a cell in A1 notation e.g. "A1", "B2", etc. The row and column are zero-based indices, so "A1" corresponds to (0, 0) and "B2" corresponds to (1, 1). This struct is immutable and provides methods for parsing, comparing, and converting to string representation.

Declaration
public CellRef(int row, int column)
Parameters
Type Name Description
int row
int column

Properties

Columnlink

Gets the column index of the cell reference. The column index is zero-based, so the first column (A1) corresponds to 0.

Declaration
public int Column { get; }
Property Value
Type Description
intGets the column index of the cell reference. The column index is zero-based, so the first column (A1) corresponds to 0.

Invalidlink

Represents an invalid cell reference with row and column set to -1.

Declaration
public Documents.Spreadsheet.CellRef Invalid { get; }
Property Value
Type Description
Documents.Spreadsheet.CellRefRepresents an invalid cell reference with row and column set to -1.

IsColumnAbsolutelink

Indicates whether the column reference is absolute (prefixed with '$' in A1 notation).

Declaration
public bool IsColumnAbsolute { get; set; }
Property Value
Type Description
boolIndicates whether the column reference is absolute (prefixed with '$' in A1 notation).

IsRowAbsolutelink

Indicates whether the row reference is absolute (prefixed with '$' in A1 notation).

Declaration
public bool IsRowAbsolute { get; set; }
Property Value
Type Description
boolIndicates whether the row reference is absolute (prefixed with '$' in A1 notation).

Rowlink

Gets the row index of the cell reference. The row index is zero-based, so the first row (A1) corresponds to 0.

Declaration
public int Row { get; }
Property Value
Type Description
intGets the row index of the cell reference. The row index is zero-based, so the first row (A1) corresponds to 0.

Worksheetlink

Gets the optional sheet name qualifier for this reference. When null, the reference targets the current sheet.

Declaration
public string Worksheet { get; set; }
Property Value
Type Description
stringGets the optional sheet name qualifier for this reference. When null, the reference targets the current sheet.

Methods

Equalslink

Declaration
public bool Equals(Documents.Spreadsheet.CellRef other)
Parameters
Type Name Description
Documents.Spreadsheet.CellRef other
Returns
Type Description
bool

Equalslink

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj
Returns
Type Description
bool

GetHashCodelink

Declaration
public override int GetHashCode()
Returns
Type Description
int

Parselink

Parses a string in A1 notation (e.g., "A1", "B2") into a CellRef instance. If the string is not a valid A1 notation, it throws an ArgumentException.

Declaration
public static Documents.Spreadsheet.CellRef Parse(string index)
Parameters
Type Name Description
string index The A1 notation string to parse.
Returns
Type Description
Documents.Spreadsheet.CellRefA CellRef instance representing the parsed cell reference.

Swaplink

Swaps two CellRef instances if the first one is greater than the second one. This is useful for ensuring a consistent order when comparing or storing cell references.

Declaration
public static ValueTuple<Documents.Spreadsheet.CellRef, Documents.Spreadsheet.CellRef> Swap(Documents.Spreadsheet.CellRef a, Documents.Spreadsheet.CellRef b)
Parameters
Returns
Type Description
ValueTuple<Documents.Spreadsheet.CellRef, Documents.Spreadsheet.CellRef>

ToRangelink

Converts the cell reference to a range reference that includes the cell itself.

Declaration
public Documents.Spreadsheet.RangeRef ToRange()
Returns

ToStringlink

Returns a string representation of the cell reference in A1 notation. For example, if the cell reference is (0, 0), it returns "A1"; if the cell reference is (1, 1), it returns "B2".

Declaration
public override string ToString()
Returns
Type Description
string

TryParselink

Attempts to parse a string in A1 notation (optionally with '$' absolute markers) into a CellRef instance. Returns true if successful and outputs absolute flags for the column and row.

Declaration
public static bool TryParse(string index, Documents.Spreadsheet.CellRef& result)
Parameters
Type Name Description
string index
Documents.Spreadsheet.CellRef& result
Returns
Type Description
bool

Operators

operator !=link

Declaration
public static bool operator !=(Documents.Spreadsheet.CellRef left, Documents.Spreadsheet.CellRef right)
Parameters
Returns
Type Description
bool

operator ==link

Declaration
public static bool operator ==(Documents.Spreadsheet.CellRef left, Documents.Spreadsheet.CellRef right)
Parameters
Returns
Type Description
bool
An error has occurred. This app may no longer respond until reloaded. Reload 🗙