Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

ExcelCellScope

OfficeIMO.Excel

Namespace
OfficeIMO.Excel
Assembly
OfficeIMO.Excel
Modifiers
sealed

Edits one ExcelCell: its fluent methods and keywords, each returning this scope.

Inheritance

  • object
  • ExcelCellScope

Usage

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

Accepted by parameters 2

Methods

public ExcelCellScope Baseline() #

Restores the cell text to the normal baseline.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Bold(bool bold = true) #

Sets or clears bold font style.

Parameters

bold bool = true optional
The value.

Returns

ExcelCellScope The same scope.
Border 2 overloads
public ExcelCellScope Border(ExcelBorderStyle style, OfficeColor? color = null) #

Applies a border style to the cell.

Parameters

style OfficeIMO.Excel.ExcelBorderStyle required
The value.
color OfficeIMO.OfficeColor? = null optional
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Border(ExcelCellBorders borders, ExcelBorderStyle style, OfficeColor? color = null) #

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

Parameters

borders OfficeIMO.Excel.ExcelCellBorders required
The value.
style OfficeIMO.Excel.ExcelBorderStyle required
The value.
color OfficeIMO.OfficeColor? = null optional
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Color(OfficeColor color) #

Sets the font color using a hex color value.

Parameters

color OfficeIMO.OfficeColor required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope DiagonalBorder(ExcelBorderStyle style, OfficeColor? color = null, bool diagonalUp = true, bool diagonalDown = true) #

Applies diagonal borders to the cell.

Parameters

style OfficeIMO.Excel.ExcelBorderStyle required
The value.
color OfficeIMO.OfficeColor? = null optional
The value.
diagonalUp bool = true optional
The value.
diagonalDown bool = true optional
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Error(string errorText) #

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

Parameters

errorText string required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope FillColor(OfficeColor color) #

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

Parameters

color OfficeIMO.OfficeColor required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope FontFamily(string fontFamily) #

Sets the font family name.

Parameters

fontFamily string required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope FontSize(OfficeLength fontSize) #

Sets a positive physical font size.

Parameters

fontSize OfficeIMO.OfficeLength required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Formula(string formula) #

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
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope GradientFill(OfficeColor fromColor, OfficeColor toColor, double degree = 0) #

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

Parameters

fromColor OfficeIMO.OfficeColor required
The value.
toColor OfficeIMO.OfficeColor required
The value.
degree double = 0 optional
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope HorizontalAlignment(ExcelHorizontalAlignment alignment) #

Sets the horizontal alignment.

Parameters

alignment OfficeIMO.Excel.ExcelHorizontalAlignment required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Italic(bool italic = true) #

Sets or clears italic font style.

Parameters

italic bool = true optional
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope NumberFormat(string numberFormat) #

Applies a number format to the cell.

Parameters

numberFormat string required
The value.

Returns

ExcelCellScope The same scope.
RichText 2 overloads
public ExcelCellScope RichText(params ExcelRichTextRun[] runs) #

Replaces the cell contents with rich inline text runs.

Parameters

runs OfficeIMO.Excel.ExcelRichTextRun[] required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope RichText(IEnumerable<ExcelRichTextRun> runs) #

Replaces the cell contents with rich inline text runs.

Parameters

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

Returns

ExcelCellScope The same scope.
public ExcelCellScope ShrinkToFit(bool shrinkToFit = true) #

Sets or clears shrink-to-fit text alignment.

Parameters

shrinkToFit bool = true optional
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Strikethrough(bool strikethrough = true) #

Sets or clears strikethrough font style.

Parameters

strikethrough bool = true optional
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Subscript() #

Formats the cell text as subscript.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Superscript() #

Formats the cell text as superscript.

Returns

ExcelCellScope The same scope.
public ExcelCellScope TextRotation(int rotation) #

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
The value.

Returns

ExcelCellScope The same scope.
Underline 2 overloads
public ExcelCellScope Underline(bool underline = true) #

Sets or clears underline font style.

Parameters

underline bool = true optional
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Underline(ExcelUnderlineStyle underlineStyle) #

Sets the native Excel underline style.

Parameters

underlineStyle OfficeIMO.Excel.ExcelUnderlineStyle required
The value.

Returns

ExcelCellScope The same scope.
Value 19 overloads
public ExcelCellScope Value(object? value) #

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
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(string value) #

Sets Value.

Parameters

value string required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(double value) #

Sets Value.

Parameters

value double required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(float value) #

Sets Value.

Parameters

value float required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(decimal value) #

Sets Value.

Parameters

value decimal required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(int value) #

Sets Value.

Parameters

value int required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(long value) #

Sets Value.

Parameters

value long required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(short value) #

Sets Value.

Parameters

value short required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(uint value) #

Sets Value.

Parameters

value uint required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(ulong value) #

Sets Value.

Parameters

value ulong required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(ushort value) #

Sets Value.

Parameters

value ushort required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(byte value) #

Sets Value.

Parameters

value byte required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(sbyte value) #

Sets Value.

Parameters

value sbyte required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(bool value = true) #

Sets Value.

Parameters

value bool = true optional
The value. True when omitted.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(DateTime value) #

Sets Value.

Parameters

value System.DateTime required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(DateTimeOffset value) #

Sets Value.

Parameters

value System.DateTimeOffset required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(TimeSpan value) #

Sets Value.

Parameters

value System.TimeSpan required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(DateOnly value) #

Sets Value.

Parameters

value System.DateOnly required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope Value(TimeOnly value) #

Sets Value.

Parameters

value System.TimeOnly required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope VerticalAlignment(ExcelVerticalAlignment alignment) #

Sets the vertical alignment.

Parameters

alignment OfficeIMO.Excel.ExcelVerticalAlignment required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope VerticalTextAlignment(ExcelVerticalTextAlignment alignment) #

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

Parameters

alignment OfficeIMO.Excel.ExcelVerticalTextAlignment required
The value.

Returns

ExcelCellScope The same scope.
public ExcelCellScope WrapText(bool wrapText = true) #

Sets or clears text wrapping.

Parameters

wrapText bool = true optional
The value.

Returns

ExcelCellScope The same scope.

Properties

public ExcelCell Model { get; } #

The ExcelCell this scope edits, for plain C# inside a lambda.