Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/

API Reference

Class

ExcelCell

Namespace OfficeIMO.Excel
Assembly OfficeIMO.Excel
Modifiers sealed

Lightweight object model wrapper for a single worksheet cell.

Inheritance

  • Object
  • ExcelCell

Usage

Explore 39 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.

Methods

public ExcelCell Clear(ExcelClearOptions options = All) #
Returns: ExcelCell

Clears selected cell data and metadata.

Parameters

options OfficeIMO.Excel.ExcelClearOptions = All optionalposition: 0
public ExcelCell Currency(Int32 decimals = 2, CultureInfo? culture = null) #
Returns: ExcelCell

Applies a currency number format.

Parameters

decimals System.Int32 = 2 optionalposition: 0
culture System.Globalization.CultureInfo? = null optionalposition: 1
public ExcelCell Date(String pattern = "yyyy-mm-dd") #
Returns: ExcelCell

Applies a date number format.

Parameters

pattern System.String = "yyyy-mm-dd" optionalposition: 0
public ExcelCell DateTime(String pattern = "yyyy-mm-dd hh:mm:ss") #
Returns: ExcelCell

Applies a date/time number format.

Parameters

pattern System.String = "yyyy-mm-dd hh:mm:ss" optionalposition: 0
public ExcelCell DurationHours() #
Returns: ExcelCell

Applies an elapsed-hours duration format.

public ExcelCell Error() #
Returns: ExcelCell

Applies an error status style.

public String GetFormattedText(IFormatProvider? provider = null) #
Returns: String

Gets formatted display text for the cell value.

Parameters

provider System.IFormatProvider? = null optionalposition: 0
public IReadOnlyList<ExcelRichTextRun> GetRichText() #
Returns: IReadOnlyList<ExcelRichTextRun>

Gets rich inline text runs from the cell.

public ExcelCellStyleSnapshot GetStyle() #
Returns: ExcelCellStyleSnapshot

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

public ExcelCellData GetValue() #
Returns: ExcelCellData

Gets a typed snapshot of the cell value.

public T? GetValue<T>() #
Returns: T?

Gets the cell value converted to the requested type.

Type Parameters

T
public ExcelCell HeaderStyle() #
Returns: ExcelCell

Applies a simple report header style.

public ExcelCell Integer() #
Returns: ExcelCell

Applies a whole-number format with thousands separators.

public ExcelCell MutedText() #
Returns: ExcelCell

Applies a muted text style.

public ExcelCell Number(Int32 decimals = 2) #
Returns: ExcelCell

Applies a decimal number format.

Parameters

decimals System.Int32 = 2 optionalposition: 0
public ExcelCell Percent(Int32 decimals = 0) #
Returns: ExcelCell

Applies a percent number format.

Parameters

decimals System.Int32 = 0 optionalposition: 0
public ExcelCell SetBaseline() #
Returns: ExcelCell

Restores the cell text to the normal baseline.

public ExcelCell SetBold(Boolean bold = true) #
Returns: ExcelCell

Sets or clears bold font style.

Parameters

bold System.Boolean = true optionalposition: 0
SetBorder 2 overloads
public ExcelCell SetBorder(ExcelBorderStyle style, String? hexColor = null) #
Returns: ExcelCell

Applies a border style to the cell.

Parameters

style OfficeIMO.Excel.ExcelBorderStyle requiredposition: 0
hexColor System.String? = null optionalposition: 1
public ExcelCell SetBorder(ExcelCellBorders borders, ExcelBorderStyle style, String? hexColor = null) #
Returns: ExcelCell

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

Parameters

borders OfficeIMO.Excel.ExcelCellBorders requiredposition: 0
style OfficeIMO.Excel.ExcelBorderStyle requiredposition: 1
hexColor System.String? = null optionalposition: 2
public ExcelCell SetDiagonalBorder(ExcelBorderStyle style, String? hexColor = null, Boolean diagonalUp = true, Boolean diagonalDown = true) #
Returns: ExcelCell

Applies diagonal borders to the cell.

Parameters

style OfficeIMO.Excel.ExcelBorderStyle requiredposition: 0
hexColor System.String? = null optionalposition: 1
diagonalUp System.Boolean = true optionalposition: 2
diagonalDown System.Boolean = true optionalposition: 3
public ExcelCell SetFillColor(String hexColor) #
Returns: ExcelCell

Sets the fill color using a hex color value.

Parameters

hexColor System.String requiredposition: 0
public ExcelCell SetFontColor(String hexColor) #
Returns: ExcelCell

Sets the font color using a hex color value.

Parameters

hexColor System.String requiredposition: 0
public ExcelCell SetFontName(String fontName) #
Returns: ExcelCell

Sets the font family name.

Parameters

fontName System.String requiredposition: 0
public ExcelCell SetFontSize(Double fontSize) #
Returns: ExcelCell

Sets the font size in points.

Parameters

fontSize System.Double requiredposition: 0
public ExcelCell SetFormula(String formula) #
Returns: ExcelCell

Sets the cell formula.

Parameters

formula System.String requiredposition: 0
public ExcelCell SetGradientFill(String fromHexColor, String toHexColor, Double degree = 0) #
Returns: ExcelCell

Sets a two-color linear gradient fill using hex color values.

Parameters

fromHexColor System.String requiredposition: 0
toHexColor System.String requiredposition: 1
degree System.Double = 0 optionalposition: 2
public ExcelCell SetItalic(Boolean italic = true) #
Returns: ExcelCell

Sets or clears italic font style.

Parameters

italic System.Boolean = true optionalposition: 0
public ExcelCell SetNumberFormat(String numberFormat) #
Returns: ExcelCell

Applies a number format to the cell.

Parameters

numberFormat System.String requiredposition: 0
public ExcelCell SetRichText(params ExcelRichTextRun[] runs) #
Returns: ExcelCell

Replaces the cell contents with rich inline text runs.

Parameters

runs OfficeIMO.Excel.ExcelRichTextRun[] requiredposition: 0
public ExcelCell SetShrinkToFit(Boolean shrinkToFit = true) #
Returns: ExcelCell

Sets or clears shrink-to-fit text alignment.

Parameters

shrinkToFit System.Boolean = true optionalposition: 0
public ExcelCell SetStrikethrough(Boolean strikethrough = true) #
Returns: ExcelCell

Sets or clears strikethrough font style.

Parameters

strikethrough System.Boolean = true optionalposition: 0
public ExcelCell SetSubscript() #
Returns: ExcelCell

Formats the cell text as subscript.

public ExcelCell SetSuperscript() #
Returns: ExcelCell

Formats the cell text as superscript.

public ExcelCell SetTextRotation(Int32 rotation) #
Returns: ExcelCell

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

Parameters

rotation System.Int32 requiredposition: 0
SetUnderline 2 overloads
public ExcelCell SetUnderline(Boolean underline = true) #
Returns: ExcelCell

Sets or clears underline font style.

Parameters

underline System.Boolean = true optionalposition: 0
public ExcelCell SetUnderline(ExcelUnderlineStyle underlineStyle) #
Returns: ExcelCell

Sets the native Excel underline style.

Parameters

underlineStyle OfficeIMO.Excel.ExcelUnderlineStyle requiredposition: 0
public ExcelCell SetValue(Object? value) #
Returns: ExcelCell

Sets the cell value.

Parameters

value System.Object? requiredposition: 0
public ExcelCell SetVerticalTextAlignment(ExcelVerticalTextAlignment alignment) #
Returns: ExcelCell

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

Parameters

alignment OfficeIMO.Excel.ExcelVerticalTextAlignment requiredposition: 0
public ExcelCell Success() #
Returns: ExcelCell

Applies a positive/success status style.

public ExcelCell Text() #
Returns: ExcelCell

Applies a text number format.

public ExcelCell Time() #
Returns: ExcelCell

Applies a time number format.

public ExcelCell TransformTextCase(OfficeTextCase textCase, CultureInfo? culture = null) #
Returns: ExcelCell

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

Parameters

textCase OfficeIMO.Drawing.OfficeTextCase requiredposition: 0
culture System.Globalization.CultureInfo? = null optionalposition: 1
public Boolean TryGetValue<T>(out T? value) #
Returns: Boolean

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

Type Parameters

T

Parameters

value T? requiredposition: 0
public ExcelCell Warning() #
Returns: ExcelCell

Applies a warning status style.

Properties

public ExcelSheet Sheet { get; } #

Gets the worksheet that owns the cell.

public Int32 Row { get; } #

Gets the 1-based row index.

public Int32 Column { get; } #

Gets the 1-based column index.

public String Address { get; } #

Gets the A1 cell address.