Table of Contents

ExcelCell Struct

Definition

Namespace
Bodu.Formats.Excel
Assembly
Bodu.Formats.Excel.Binary.dll
Package
Bodu.Formats.Excel.Binary 1.0.0
Source
ExcelCell.cs

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

Gets the boolean value when Kind is Boolean; otherwise null.

public bool? BooleanValue { get; }

Property Value

bool?

The boolean value, or null.

ColumnIndex

Gets the zero-based column index of the cell.

public int ColumnIndex { get; }

Property Value

int

The column index.

ErrorValue

Gets the error code when Kind is Error; otherwise null.

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

bool

true when Kind is Number and the cell's format is a date or time format; otherwise false.

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

Gets the numeric value when Kind is Number; otherwise null.

public double? NumberValue { get; }

Property Value

double?

The numeric value, or null.

RowIndex

Gets the zero-based row index of the cell.

public int RowIndex { get; }

Property Value

int

The row index.

StringValue

Gets the text value when Kind is String; otherwise null.

public string? StringValue { get; }

Property Value

string

The text value, or null.

Methods

Boolean(int, int, bool, ushort)

Creates a boolean cell.

public static ExcelCell Boolean(int rowIndex, int columnIndex, bool value, ushort formatIndex = 0)

Parameters

rowIndex int

The zero-based row index.

columnIndex int

The zero-based column index.

value bool

The boolean value.

formatIndex ushort

The number-format index applied to the cell.

Returns

ExcelCell

An ExcelCell of kind Boolean.

Equals(ExcelCell)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(ExcelCell other)

Parameters

other ExcelCell

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Error(int, int, ExcelErrorCode, ushort)

Creates an error cell.

public static ExcelCell Error(int rowIndex, int columnIndex, ExcelErrorCode errorCode, ushort formatIndex = 0)

Parameters

rowIndex int

The zero-based row index.

columnIndex int

The zero-based column index.

errorCode ExcelErrorCode

The spreadsheet error code.

formatIndex ushort

The number-format index applied to the cell.

Returns

ExcelCell

An ExcelCell of kind Error.

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

rowIndex int

The zero-based row index.

columnIndex int

The zero-based column index.

value double

The numeric value.

formatIndex ushort

The number-format index applied to the cell.

isDateFormatted bool

Whether the cell's format renders the number as a date or time.

Returns

ExcelCell

An ExcelCell of kind Number.

Text(int, int, string, ushort)

Creates a text cell.

public static ExcelCell Text(int rowIndex, int columnIndex, string value, ushort formatIndex = 0)

Parameters

rowIndex int

The zero-based row index.

columnIndex int

The zero-based column index.

value string

The text value.

formatIndex ushort

The number-format index applied to the cell.

Returns

ExcelCell

An ExcelCell of kind String.

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

left ExcelCell
right ExcelCell

Returns

bool

operator !=(ExcelCell, ExcelCell)

public static bool operator !=(ExcelCell left, ExcelCell right)

Parameters

left ExcelCell
right ExcelCell

Returns

bool

Applies to

ProductVersions
.NET8, 10