# ExcelCell

A worksheet cell handle: the sheet plus a 1-based row and column.

Struct 

`OfficeIMO.Excel`

**Namespace**

`OfficeIMO.Excel`

**Assembly**

`OfficeIMO.Excel`

**Source revision**

`273d35d5ba8a` with working tree changes

**Source**

[ExcelCell.cs:34](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L34)

**Base**

`ValueType`

**Implements**

`IEquatable<ExcelCell>`

**Modifiers**

sealed

A worksheet cell handle: the sheet plus a 1-based row and column. It stores no cell state, so creating one in a loop allocates nothing; every member reads or writes the worksheet directly.

## Inheritance

- ValueType
- ExcelCell

## Guides & Samples

Authored walkthroughs and practical samples linked to this API.

- [Worksheets](/docs/excel/worksheets/) Guide
  
  Working with Excel worksheets in OfficeIMO.Excel — cells, formatting, formulas, and named ranges. Includes examples and API links.

## Usage

Explore 36 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 31

- Method [ExcelCell.Clear](/api/excel/officeimo-excel-excelcell/#method-clear-officeimo-excel-excelclearoptions)
- Method [ExcelCell.SetBaseline](/api/excel/officeimo-excel-excelcell/#method-setbaseline)
- Method [ExcelCell.SetBold](/api/excel/officeimo-excel-excelcell/#method-setbold-boolean)
- Method [ExcelCell.SetBorder](/api/excel/officeimo-excel-excelcell/#method-setborder-officeimo-excel-excelcellborders-officeimo-excel-excelborderstyle-nullable-officeimo-officecolor)
- Method [ExcelCell.SetColor](/api/excel/officeimo-excel-excelcell/#method-setcolor-officeimo-officecolor)
- Method [ExcelCell.SetDiagonalBorder](/api/excel/officeimo-excel-excelcell/#method-setdiagonalborder-officeimo-excel-excelborderstyle-nullable-officeimo-officecolor-boolean-boolean)
- Method [ExcelCell.SetError](/api/excel/officeimo-excel-excelcell/#method-seterror-string)
- Method [ExcelCell.SetFillColor](/api/excel/officeimo-excel-excelcell/#method-setfillcolor-officeimo-officecolor)
- Method [ExcelCell.SetFontFamily](/api/excel/officeimo-excel-excelcell/#method-setfontfamily-string)
- Method [ExcelCell.SetFontSize](/api/excel/officeimo-excel-excelcell/#method-setfontsize-officeimo-officelength)
- Method [ExcelCell.SetFormula](/api/excel/officeimo-excel-excelcell/#method-setformula-string)
- Method [ExcelCell.SetGradientFill](/api/excel/officeimo-excel-excelcell/#method-setgradientfill-officeimo-officecolor-officeimo-officecolor-double)
- Method [ExcelCell.SetHorizontalAlignment](/api/excel/officeimo-excel-excelcell/#method-sethorizontalalignment-officeimo-excel-excelhorizontalalignment)
- Method [ExcelCell.SetItalic](/api/excel/officeimo-excel-excelcell/#method-setitalic-boolean)
- Method [ExcelCell.SetNumberFormat](/api/excel/officeimo-excel-excelcell/#method-setnumberformat-string)
- Method [ExcelCell.SetRichText](/api/excel/officeimo-excel-excelcell/#method-setrichtext-officeimo-excel-excelrichtextrun)
- Method [ExcelCell.SetShrinkToFit](/api/excel/officeimo-excel-excelcell/#method-setshrinktofit-boolean)
- Method [ExcelCell.SetStrikethrough](/api/excel/officeimo-excel-excelcell/#method-setstrikethrough-boolean)
- Method [ExcelCell.SetSubscript](/api/excel/officeimo-excel-excelcell/#method-setsubscript)
- Method [ExcelCell.SetSuperscript](/api/excel/officeimo-excel-excelcell/#method-setsuperscript)
- Method [ExcelCell.SetTextRotation](/api/excel/officeimo-excel-excelcell/#method-settextrotation-int32)
- Method [ExcelCell.SetUnderline](/api/excel/officeimo-excel-excelcell/#method-setunderline-officeimo-excel-excelunderlinestyle)
- Method [ExcelCell.SetValue](/api/excel/officeimo-excel-excelcell/#method-setvalue-object)
- Method [ExcelCell.SetValue``1](/api/excel/officeimo-excel-excelcell/#method-setvalue-nullable)
- Method [ExcelCell.SetVerticalAlignment](/api/excel/officeimo-excel-excelcell/#method-setverticalalignment-officeimo-excel-excelverticalalignment)
- Method [ExcelCell.SetVerticalTextAlignment](/api/excel/officeimo-excel-excelcell/#method-setverticaltextalignment-officeimo-excel-excelverticaltextalignment)
- Method [ExcelCell.SetWrapText](/api/excel/officeimo-excel-excelcell/#method-setwraptext-boolean)
- Method [ExcelCell.TransformTextCase](/api/excel/officeimo-excel-excelcell/#method-transformtextcase-officeimo-drawing-officetextcase-globalization-cultureinfo)
- Method [ExcelRange.Cell](/api/excel/officeimo-excel-excelrange/#method-cell-int32-int32)
- Property [ExcelRange.FirstCell](/api/excel/officeimo-excel-excelrange/#property-firstcell)
- Method [ExcelSheet.Cell](/api/excel/officeimo-excel-excelsheet/#method-cell-int32-int32)

### Accepted by parameters 5

- Method [ExcelCell.Equals](/api/excel/officeimo-excel-excelcell/#method-equals-officeimo-excel-excelcell) parameter `other`
- Method [ExcelCell.op_Equality](/api/excel/officeimo-excel-excelcell/#method-op-equality-officeimo-excel-excelcell-officeimo-excel-excelcell) parameter `left`
- Method [ExcelCell.op_Equality](/api/excel/officeimo-excel-excelcell/#method-op-equality-officeimo-excel-excelcell-officeimo-excel-excelcell) parameter `right`
- Method [ExcelCell.op_Inequality](/api/excel/officeimo-excel-excelcell/#method-op-inequality-officeimo-excel-excelcell-officeimo-excel-excelcell) parameter `left`
- Method [ExcelCell.op_Inequality](/api/excel/officeimo-excel-excelcell/#method-op-inequality-officeimo-excel-excelcell-officeimo-excel-excelcell) parameter `right`

Filter members 

Show inherited

## Methods

`public ExcelCell Clear(ExcelClearOptions options = All)` [#](#method-clear-officeimo-excel-excelclearoptions)

[ExcelCell.cs:141](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L141)

Clears selected cell data and metadata.

Parameters

**options OfficeIMO.Excel.ExcelClearOptions = All optional**

Returns

`ExcelCell`

Equals 2 overloads

`public bool Equals(ExcelCell other)` [#](#method-equals-officeimo-excel-excelcell)

[ExcelCell.cs:334](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L334)

Returns whether both handles address the same cell of the same worksheet object.

Parameters

**other OfficeIMO.Excel.ExcelCell required**

Returns

`bool`

`public override bool Equals(object? obj)` [#](#method-equals-object)

[ExcelCell.cs:337](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L337)

Indicates whether this instance and a specified object are equal.

Parameters

**obj object? required**

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.

`public string GetFormattedText(IFormatProvider? provider = null)` [#](#method-getformattedtext-iformatprovider)

[ExcelCell.cs:39](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L39)

Gets formatted display text for the cell value.

Parameters

**provider System.IFormatProvider? = null optional**

Returns

`string`

`public override int GetHashCode()` [#](#method-gethashcode)

[ExcelCell.cs:342](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L342)

Returns the hash code for this instance.

Returns

`int` A 32-bit signed integer that is the hash code for this instance.

`public IReadOnlyList<ExcelRichTextRun> GetRichText()` [#](#method-getrichtext)

[ExcelCell.cs:331](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L331)

Gets rich inline text runs from the cell.

Returns

`IReadOnlyList<ExcelRichTextRun>`

`public ExcelCellStyleInfo GetStyle()` [#](#method-getstyle)

[ExcelSheet.CellStyle.cs:12](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelSheet.CellStyle.cs#L12)

Gets a read-only snapshot of the cell's visual style.

Returns

`ExcelCellStyleInfo`

`public ExcelCellData GetValue()` [#](#method-getvalue)

[ExcelCell.cs:34](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L34)

Gets a typed snapshot of the cell value.

Returns

`ExcelCellData`

`public T? GetValue<T>()` [#](#method-getvalue-2)

[ExcelCell.cs:45](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L45)

Gets the cell value converted to the requested type.

Type Parameters

**T**

Returns

`T?`

`public static bool op_Equality(ExcelCell left, ExcelCell right)` [#](#method-op-equality-officeimo-excel-excelcell-officeimo-excel-excelcell)

[ExcelCell.cs:348](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L348)

Returns whether both handles address the same cell.

Parameters

**left OfficeIMO.Excel.ExcelCell required**

**right OfficeIMO.Excel.ExcelCell required**

Returns

`bool`

`public static bool op_Inequality(ExcelCell left, ExcelCell right)` [#](#method-op-inequality-officeimo-excel-excelcell-officeimo-excel-excelcell)

[ExcelCell.cs:351](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L351)

Returns whether the handles address different cells.

Parameters

**left OfficeIMO.Excel.ExcelCell required**

**right OfficeIMO.Excel.ExcelCell required**

Returns

`bool`

`public ExcelCell SetBaseline()` [#](#method-setbaseline)

[ExcelCell.cs:209](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L209)

Restores the cell text to the normal baseline.

Returns

`ExcelCell`

`public ExcelCell SetBold(bool bold = true)` [#](#method-setbold-boolean)

[ExcelCell.cs:158](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L158)

Sets or clears bold font style.

Parameters

**bold bool = true optional**

Returns

`ExcelCell`

SetBorder 2 overloads

`public ExcelCell SetBorder(ExcelBorderStyle style, OfficeColor? color = null)` [#](#method-setborder-officeimo-excel-excelborderstyle-nullable-officeimo-officecolor)

[ExcelCell.cs:297](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L297)

Applies a border style to the cell.

Parameters

**style OfficeIMO.Excel.ExcelBorderStyle required**

**color OfficeIMO.OfficeColor? = null optional**

Returns

`ExcelCell`

`public ExcelCell SetBorder(ExcelCellBorders borders, ExcelBorderStyle style, OfficeColor? color = null)` [#](#method-setborder-officeimo-excel-excelcellborders-officeimo-excel-excelborderstyle-nullable-officeimo-officecolor)

[ExcelCell.cs:303](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L303)

Sets selected border edges while preserving other edges and cell styles.

Parameters

**borders OfficeIMO.Excel.ExcelCellBorders required**

**style OfficeIMO.Excel.ExcelBorderStyle required**

**color OfficeIMO.OfficeColor? = null optional**

Returns

`ExcelCell`

`public ExcelCell SetColor(OfficeColor color)` [#](#method-setcolor-officeimo-officecolor)

[ExcelCell.cs:241](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L241)

Sets the font color using a hex color value.

Parameters

**color OfficeIMO.OfficeColor required**

Returns

`ExcelCell`

`public ExcelCell SetDiagonalBorder(ExcelBorderStyle style, OfficeColor? color = null, bool diagonalUp = true, bool diagonalDown = true)` [#](#method-setdiagonalborder-officeimo-excel-excelborderstyle-nullable-officeimo-officecolor-boolean-boolean)

[ExcelCell.cs:311](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L311)

Applies diagonal borders to the cell.

Parameters

**style OfficeIMO.Excel.ExcelBorderStyle required**

**color OfficeIMO.OfficeColor? = null optional**

**diagonalUp bool = true optional**

**diagonalDown bool = true optional**

Returns

`ExcelCell`

`public ExcelCell SetError(string errorText)` [#](#method-seterror-string)

[ExcelCell.cs:126](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L126)

Writes a native Excel error value, such as #N/A or #DIV/0!.

Parameters

**errorText string required**

Returns

`ExcelCell`

`public ExcelCell SetFillColor(OfficeColor color)` [#](#method-setfillcolor-officeimo-officecolor)

[ExcelCell.cs:281](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L281)

Sets the solid fill color. Theme colors stay linked to the workbook theme.

Parameters

**color OfficeIMO.OfficeColor required**

Returns

`ExcelCell`

`public ExcelCell SetFontFamily(string fontFamily)` [#](#method-setfontfamily-string)

[ExcelCell.cs:224](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L224)

Sets the font family name.

Parameters

**fontFamily string required**

Returns

`ExcelCell`

`public ExcelCell SetFontSize(OfficeLength fontSize)` [#](#method-setfontsize-officeimo-officelength)

[ExcelCell.cs:233](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L233)

Sets a positive physical font size.

Parameters

**fontSize OfficeIMO.OfficeLength required**

Returns

`ExcelCell`

`public ExcelCell SetFormula(string formula)` [#](#method-setformula-string)

[ExcelCell.cs:133](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L133)

Sets the cell formula while keeping any existing value as its cached result. This is not a redaction API: rebuild the workbook from approved data to remove sensitive historic content.

Parameters

**formula string required**

Returns

`ExcelCell`

`public ExcelCell SetGradientFill(OfficeColor fromColor, OfficeColor toColor, double degree = 0)` [#](#method-setgradientfill-officeimo-officecolor-officeimo-officecolor-double)

[ExcelCell.cs:289](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L289)

Sets a two-color linear gradient fill using literal or theme colors.

Parameters

**fromColor OfficeIMO.OfficeColor required**

**toColor OfficeIMO.OfficeColor required**

**degree double = 0 optional**

Returns

`ExcelCell`

`public ExcelCell SetHorizontalAlignment(ExcelHorizontalAlignment alignment)` [#](#method-sethorizontalalignment-officeimo-excel-excelhorizontalalignment)

[ExcelCell.cs:247](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L247)

Sets the horizontal alignment.

Parameters

**alignment OfficeIMO.Excel.ExcelHorizontalAlignment required**

Returns

`ExcelCell`

`public ExcelCell SetItalic(bool italic = true)` [#](#method-setitalic-boolean)

[ExcelCell.cs:166](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L166)

Sets or clears italic font style.

Parameters

**italic bool = true optional**

Returns

`ExcelCell`

`public ExcelCell SetNumberFormat(string numberFormat)` [#](#method-setnumberformat-string)

[ExcelCell.cs:149](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L149)

Applies a number format to the cell.

Parameters

**numberFormat string required**

Returns

`ExcelCell`

SetRichText 2 overloads

`public ExcelCell SetRichText(params ExcelRichTextRun[] runs)` [#](#method-setrichtext-officeimo-excel-excelrichtextrun)

[ExcelCell.cs:318](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L318)

Replaces the cell contents with rich inline text runs.

Parameters

**runs OfficeIMO.Excel.ExcelRichTextRun[] required**

Returns

`ExcelCell`

`public ExcelCell SetRichText(IEnumerable<ExcelRichTextRun> runs)` [#](#method-setrichtext-collections-generic-ienumerable-officeimo-excel-excelrichtextrun)

[ExcelCell.cs:324](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L324)

Replaces the cell contents with rich inline text runs.

Parameters

**runs System.Collections.Generic.IEnumerable<OfficeIMO.Excel.ExcelRichTextRun> required**

Returns

`ExcelCell`

`public ExcelCell SetShrinkToFit(bool shrinkToFit = true)` [#](#method-setshrinktofit-boolean)

[ExcelCell.cs:267](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L267)

Sets or clears shrink-to-fit text alignment.

Parameters

**shrinkToFit bool = true optional**

Returns

`ExcelCell`

`public ExcelCell SetStrikethrough(bool strikethrough = true)` [#](#method-setstrikethrough-boolean)

[ExcelCell.cs:190](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L190)

Sets or clears strikethrough font style.

Parameters

**strikethrough bool = true optional**

Returns

`ExcelCell`

`public ExcelCell SetSubscript()` [#](#method-setsubscript)

[ExcelCell.cs:206](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L206)

Formats the cell text as subscript.

Returns

`ExcelCell`

`public ExcelCell SetSuperscript()` [#](#method-setsuperscript)

[ExcelCell.cs:203](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L203)

Formats the cell text as superscript.

Returns

`ExcelCell`

`public ExcelCell SetTextRotation(int rotation)` [#](#method-settextrotation-int32)

[ExcelCell.cs:275](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L275)

Sets Excel text rotation. Use 0-90 for upward rotation, 91-180 for downward rotation, or 255 for stacked vertical text.

Parameters

**rotation int required**

Returns

`ExcelCell`

SetUnderline 2 overloads

`public ExcelCell SetUnderline(bool underline = true)` [#](#method-setunderline-boolean)

[ExcelCell.cs:174](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L174)

Sets or clears underline font style.

Parameters

**underline bool = true optional**

Returns

`ExcelCell`

`public ExcelCell SetUnderline(ExcelUnderlineStyle underlineStyle)` [#](#method-setunderline-officeimo-excel-excelunderlinestyle)

[ExcelCell.cs:182](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L182)

Sets the native Excel underline style.

Parameters

**underlineStyle OfficeIMO.Excel.ExcelUnderlineStyle required**

Returns

`ExcelCell`

SetValue 19 overloads

`public ExcelCell SetValue(object? value)` [#](#method-setvalue-object)

[ExcelCell.cs:83](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L83)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value object? required**

Returns

`ExcelCell`

`public ExcelCell SetValue(string value)` [#](#method-setvalue-string)

[ExcelCell.cs:85](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L85)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value string required**

Returns

`ExcelCell`

`public ExcelCell SetValue(double value)` [#](#method-setvalue-double)

[ExcelCell.cs:87](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L87)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value double required**

Returns

`ExcelCell`

`public ExcelCell SetValue(float value)` [#](#method-setvalue-single)

[ExcelCell.cs:89](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L89)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value float required**

Returns

`ExcelCell`

`public ExcelCell SetValue(decimal value)` [#](#method-setvalue-decimal)

[ExcelCell.cs:91](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L91)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value decimal required**

Returns

`ExcelCell`

`public ExcelCell SetValue(int value)` [#](#method-setvalue-int32)

[ExcelCell.cs:93](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L93)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value int required**

Returns

`ExcelCell`

`public ExcelCell SetValue(long value)` [#](#method-setvalue-int64)

[ExcelCell.cs:95](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L95)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value long required**

Returns

`ExcelCell`

`public ExcelCell SetValue(short value)` [#](#method-setvalue-int16)

[ExcelCell.cs:97](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L97)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value short required**

Returns

`ExcelCell`

`public ExcelCell SetValue(uint value)` [#](#method-setvalue-uint32)

[ExcelCell.cs:99](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L99)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value uint required**

Returns

`ExcelCell`

`public ExcelCell SetValue(ulong value)` [#](#method-setvalue-uint64)

[ExcelCell.cs:101](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L101)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value ulong required**

Returns

`ExcelCell`

`public ExcelCell SetValue(ushort value)` [#](#method-setvalue-uint16)

[ExcelCell.cs:103](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L103)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value ushort required**

Returns

`ExcelCell`

`public ExcelCell SetValue(byte value)` [#](#method-setvalue-byte)

[ExcelCell.cs:105](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L105)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value byte required**

Returns

`ExcelCell`

`public ExcelCell SetValue(sbyte value)` [#](#method-setvalue-sbyte)

[ExcelCell.cs:107](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L107)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value sbyte required**

Returns

`ExcelCell`

`public ExcelCell SetValue(bool value)` [#](#method-setvalue-boolean)

[ExcelCell.cs:109](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L109)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value bool required**

Returns

`ExcelCell`

`public ExcelCell SetValue(DateTime value)` [#](#method-setvalue-datetime)

[ExcelCell.cs:111](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L111)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value System.DateTime required**

Returns

`ExcelCell`

`public ExcelCell SetValue(DateTimeOffset value)` [#](#method-setvalue-datetimeoffset)

[ExcelCell.cs:113](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L113)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value System.DateTimeOffset required**

Returns

`ExcelCell`

`public ExcelCell SetValue(TimeSpan value)` [#](#method-setvalue-timespan)

[ExcelCell.cs:115](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L115)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value System.TimeSpan required**

Returns

`ExcelCell`

`public ExcelCell SetValue(DateOnly value)` [#](#method-setvalue-dateonly)

[ExcelCell.cs:118](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L118)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value System.DateOnly required**

Returns

`ExcelCell`

`public ExcelCell SetValue(TimeOnly value)` [#](#method-setvalue-timeonly)

[ExcelCell.cs:120](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L120)

Sets the cell value, inferring the stored type. Dates and times get a date or duration number format unless the cell already has one.

Parameters

**value System.TimeOnly required**

Returns

`ExcelCell`

`public ExcelCell SetValue<T>(T? value)` [#](#method-setvalue-nullable)

[ExcelCell.cs:123](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L123)

Sets the cell value from a nullable value; null writes an empty value.

Type Parameters

**T**

Parameters

**value T? required**

Returns

`ExcelCell`

`public ExcelCell SetVerticalAlignment(ExcelVerticalAlignment alignment)` [#](#method-setverticalalignment-officeimo-excel-excelverticalalignment)

[ExcelCell.cs:253](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L253)

Sets the vertical alignment.

Parameters

**alignment OfficeIMO.Excel.ExcelVerticalAlignment required**

Returns

`ExcelCell`

`public ExcelCell SetVerticalTextAlignment(ExcelVerticalTextAlignment alignment)` [#](#method-setverticaltextalignment-officeimo-excel-excelverticaltextalignment)

[ExcelCell.cs:198](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L198)

Sets the native Excel baseline, superscript, or subscript alignment.

Parameters

**alignment OfficeIMO.Excel.ExcelVerticalTextAlignment required**

Returns

`ExcelCell`

`public ExcelCell SetWrapText(bool wrapText = true)` [#](#method-setwraptext-boolean)

[ExcelCell.cs:259](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L259)

Sets or clears text wrapping.

Parameters

**wrapText bool = true optional**

Returns

`ExcelCell`

`public ExcelCell TransformTextCase(OfficeTextCase textCase, CultureInfo? culture = null)` [#](#method-transformtextcase-officeimo-drawing-officetextcase-globalization-cultureinfo)

[ExcelCell.cs:216](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L216)

Changes stored text casing while preserving cell or rich-run formatting. Formulas and non-text values are left unchanged.

Parameters

**textCase OfficeIMO.Drawing.OfficeTextCase required**

**culture System.Globalization.CultureInfo? = null optional**

Returns

`ExcelCell`

`public bool TryGetValue<T>(out T? value)` [#](#method-trygetvalue)

[ExcelCell.cs:62](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L62)

Tries to get the cell value converted to the requested type.

Type Parameters

**T**

Parameters

**value T? required**

Returns

`bool`

## Inherited Methods

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public override string? ToString()` [#](#method-tostring)

Inherited from ValueType

Returns

`string?`

## Properties

`public ExcelSheet Sheet { get; }` [#](#property-sheet)

[ExcelCell.cs:23](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L23)

Gets the worksheet that owns the cell.

Exceptions

- `InvalidOperationException` – The handle is default and has no worksheet.

`public int Row { get; }` [#](#property-row)

[ExcelCell.cs:25](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L25)

Gets the 1-based row index.

`public int Column { get; }` [#](#property-column)

[ExcelCell.cs:27](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L27)

Gets the 1-based column index.

`public string Address { get; }` [#](#property-address)

[ExcelCell.cs:29](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.Excel/ExcelCell.cs#L29)

Gets the A1 cell address.

<!-- PowerForge markdown artifact sha256:88CF308123EB6DC3C82E4AAEF18159EFD8E3E0387E72638DE2F37A8C3F3E22E5 -->
