ExcelCell Struct
Definition
Represents a single populated cell read from a BIFF worksheet, carrying its zero-based position and raw value.
public readonly struct ExcelCell : IEquatable<ExcelCell>
- Implements
- Inherited Members
- Extension Methods
Remarks
The reader emits a cell only for a populated value; absent cells are simply not returned, so a worksheet is a sparse sequence of cells. Numeric cells are returned as raw double values with no date or format interpretation applied.
Properties
BooleanValue
public bool? BooleanValue { get; }
Property Value
ColumnIndex
Gets the zero-based column index of the cell.
public int ColumnIndex { get; }
Property Value
- int
The column index.
ErrorValue
public ExcelErrorCode? ErrorValue { get; }
Property Value
- ExcelErrorCode?
The spreadsheet error code, or null.
FormatIndex
Gets the number-format index applied to the cell.
public ushort FormatIndex { get; }
Property Value
- ushort
The format index referenced by the cell's record;
0(the General format) when no format is recorded.
IsDateFormatted
Gets a value indicating whether the cell is a number formatted as a date or time.
public bool IsDateFormatted { get; }
Property Value
Remarks
Use ExcelSerialDate with the workbook's date system to convert a date-formatted number to a calendar value.
Kind
Gets the classification of the cell's value.
public ExcelCellKind Kind { get; }
Property Value
- ExcelCellKind
The cell kind.
NumberValue
public double? NumberValue { get; }
Property Value
RowIndex
Gets the zero-based row index of the cell.
public int RowIndex { get; }
Property Value
- int
The row index.
StringValue
public string? StringValue { get; }
Property Value
Methods
Boolean(int, int, bool, ushort)
Creates a boolean cell.
public static ExcelCell Boolean(int rowIndex, int columnIndex, bool value, ushort formatIndex = 0)
Parameters
rowIndexintThe zero-based row index.
columnIndexintThe zero-based column index.
valueboolThe boolean value.
formatIndexushortThe number-format index applied to the cell.
Returns
Equals(ExcelCell)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ExcelCell other)
Parameters
otherExcelCellAn object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
Error(int, int, ExcelErrorCode, ushort)
Creates an error cell.
public static ExcelCell Error(int rowIndex, int columnIndex, ExcelErrorCode errorCode, ushort formatIndex = 0)
Parameters
rowIndexintThe zero-based row index.
columnIndexintThe zero-based column index.
errorCodeExcelErrorCodeThe spreadsheet error code.
formatIndexushortThe number-format index applied to the cell.
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Number(int, int, double, ushort, bool)
Creates a numeric cell.
public static ExcelCell Number(int rowIndex, int columnIndex, double value, ushort formatIndex = 0, bool isDateFormatted = false)
Parameters
rowIndexintThe zero-based row index.
columnIndexintThe zero-based column index.
valuedoubleThe numeric value.
formatIndexushortThe number-format index applied to the cell.
isDateFormattedboolWhether the cell's format renders the number as a date or time.
Returns
Text(int, int, string, ushort)
Creates a text cell.
public static ExcelCell Text(int rowIndex, int columnIndex, string value, ushort formatIndex = 0)
Parameters
rowIndexintThe zero-based row index.
columnIndexintThe zero-based column index.
valuestringThe text value.
formatIndexushortThe number-format index applied to the cell.
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator ==(ExcelCell, ExcelCell)
public static bool operator ==(ExcelCell left, ExcelCell right)
Parameters
Returns
operator !=(ExcelCell, ExcelCell)
public static bool operator !=(ExcelCell left, ExcelCell right)
Parameters
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |