• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Struct CellAddress

Represents a cell address with row and column coordinates.

Inherited Members
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetType()
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public struct CellAddress

Constructors

CellAddress(Cell)

Initializes a new instance of the CellAddress struct from a cell.

Declaration
public CellAddress(Cell c)
Parameters
Type Name Description
Cell c

The cell to create the address from.

CellAddress(bool, int, bool, int)

Initializes a new instance of the CellAddress struct with absolute reference flags.

Declaration
public CellAddress(bool absoluteRow, int row, bool absoluteColumn, int column)
Parameters
Type Name Description
bool absoluteRow

Whether the row reference is absolute.

int row

The row index.

bool absoluteColumn

Whether the column reference is absolute.

int column

The column index.

CellAddress(int, int)

Construct a CellAddress based zero based row anc column indexes.

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

The zero-based row index.

int column

The zero-based column index.

Properties

AbsoluteColumn

Gets a value indicating whether the column reference is absolute.

Declaration
public bool AbsoluteColumn { get; }
Property Value
Type Description
bool

AbsoluteLabel

Gets the absolute label of the cell address (e.g., $A$1).

Declaration
public string AbsoluteLabel { get; }
Property Value
Type Description
string

AbsoluteRow

Gets a value indicating whether the row reference is absolute.

Declaration
public bool AbsoluteRow { get; }
Property Value
Type Description
bool

Column

Gets the column index of the cell address.

Declaration
public int Column { get; }
Property Value
Type Description
int

Label

Gets the label of the cell address (e.g., A1).

Declaration
public string Label { get; }
Property Value
Type Description
string

Row

Gets the row index of the cell address.

Declaration
public int Row { get; }
Property Value
Type Description
int

Methods

ColumnFromName(string)

Converts a column name to its zero-based index.

Declaration
public static int ColumnFromName(string s)
Parameters
Type Name Description
string s

The column name (e.g., "A", "B", "AA").

Returns
Type Description
int

The zero-based column index.

Equals(CellAddress)

Determines whether this cell address equals another cell address.

Declaration
public bool Equals(CellAddress other)
Parameters
Type Name Description
CellAddress other

The other cell address.

Returns
Type Description
bool

True if the addresses are equal; otherwise, false.

Equals(object)

Determines whether this cell address equals an object.

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

The object to compare.

Returns
Type Description
bool

True if the object is a CellAddress with equal values; otherwise, false.

Overrides
ValueType.Equals(object)

GetHashCode()

Serves as the default hash function for CellAddress.

Declaration
public override int GetHashCode()
Returns
Type Description
int

A hash code for the cell address.

Overrides
ValueType.GetHashCode()

Parse(string)

Parses a string into a CellAddress instance.

Declaration
public static CellAddress Parse(string s)
Parameters
Type Name Description
string s

The string to parse (e.g., "A1", "$B$2").

Returns
Type Description
CellAddress

The parsed cell address.

ToString()

Returns a string representation of the cell address.

Declaration
public override string ToString()
Returns
Type Description
string

The cell address label.

Overrides
ValueType.ToString()

TryParse(string, out CellAddress)

Attempts to parse a string into a CellAddress instance.

Declaration
public static bool TryParse(string s, out CellAddress result)
Parameters
Type Name Description
string s

The string to parse.

CellAddress result

The parsed cell address, or an empty address if parsing failed.

Returns
Type Description
bool

True if parsing succeeded; otherwise, false.

Operators

operator +(CellAddress, CellRelativeAddress)

Adds a relative address to a cell address.

Declaration
public static CellAddress operator +(CellAddress a, CellRelativeAddress b)
Parameters
Type Name Description
CellAddress a

The source address.

CellRelativeAddress b

The relative address offset.

Returns
Type Description
CellAddress

The resulting cell address.

operator +(CellAddress, CellSpan)

Adds a cell span to a cell address.

Declaration
public static CellAddress operator +(CellAddress a, CellSpan b)
Parameters
Type Name Description
CellAddress a

The source address.

CellSpan b

The cell span offset.

Returns
Type Description
CellAddress

The resulting cell address.

operator ==(CellAddress, CellAddress)

Determines whether two cell addresses are equal.

Declaration
public static bool operator ==(CellAddress a, CellAddress b)
Parameters
Type Name Description
CellAddress a

The first address.

CellAddress b

The second address.

Returns
Type Description
bool

True if the addresses are equal; otherwise, false.

operator !=(CellAddress, CellAddress)

Determines whether two cell addresses are not equal.

Declaration
public static bool operator !=(CellAddress a, CellAddress b)
Parameters
Type Name Description
CellAddress a

The first address.

CellAddress b

The second address.

Returns
Type Description
bool

True if the addresses are not equal; otherwise, false.

operator -(CellAddress, CellAddress)

Subtracts one cell address from another to get a relative address.

Declaration
public static CellRelativeAddress operator -(CellAddress a, CellAddress b)
Parameters
Type Name Description
CellAddress a

The minuend address.

CellAddress b

The subtrahend address.

Returns
Type Description
CellRelativeAddress

The relative address between the two cells.

operator -(CellAddress, CellRelativeAddress)

Subtracts a relative address from a cell address.

Declaration
public static CellAddress operator -(CellAddress a, CellRelativeAddress b)
Parameters
Type Name Description
CellAddress a

The source address.

CellRelativeAddress b

The relative address offset.

Returns
Type Description
CellAddress

The resulting cell address.

Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX