# ExcelRangeScope

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

Class 

`OfficeIMO.Excel`

**Namespace**

`OfficeIMO.Excel`

**Assembly**

`OfficeIMO.Excel`

**Modifiers**

sealed

Edits one [ExcelRange](/api/excel/officeimo-excel-excelrange/): its fluent methods and keywords, each returning this scope.

## Inheritance

- object
- ExcelRangeScope

## Usage

Explore 25 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 24

- Method [ExcelRangeScope.Baseline](/api/excel/officeimo-excel-excelrangescope/#method-baseline)
- Method [ExcelRangeScope.Bold](/api/excel/officeimo-excel-excelrangescope/#method-bold-boolean)
- Method [ExcelRangeScope.Border](/api/excel/officeimo-excel-excelrangescope/#method-border-officeimo-excel-excelcellborders-officeimo-excel-excelborderstyle-nullable-officeimo-officecolor)
- Method [ExcelRangeScope.Cell](/api/excel/officeimo-excel-excelrangescope/#method-cell-int32-int32-action-officeimo-excel-excelcellscope)
- Method [ExcelRangeScope.Color](/api/excel/officeimo-excel-excelrangescope/#method-color-officeimo-officecolor)
- Method [ExcelRangeScope.DiagonalBorder](/api/excel/officeimo-excel-excelrangescope/#method-diagonalborder-officeimo-excel-excelborderstyle-nullable-officeimo-officecolor-boolean-boolean)
- Method [ExcelRangeScope.FillColor](/api/excel/officeimo-excel-excelrangescope/#method-fillcolor-officeimo-officecolor)
- Method [ExcelRangeScope.FontFamily](/api/excel/officeimo-excel-excelrangescope/#method-fontfamily-string)
- Method [ExcelRangeScope.FontSize](/api/excel/officeimo-excel-excelrangescope/#method-fontsize-officeimo-officelength)
- Method [ExcelRangeScope.GradientFill](/api/excel/officeimo-excel-excelrangescope/#method-gradientfill-officeimo-officecolor-officeimo-officecolor-double)
- Method [ExcelRangeScope.HorizontalAlignment](/api/excel/officeimo-excel-excelrangescope/#method-horizontalalignment-officeimo-excel-excelhorizontalalignment)
- Method [ExcelRangeScope.Italic](/api/excel/officeimo-excel-excelrangescope/#method-italic-boolean)
- Method [ExcelRangeScope.NumberFormat](/api/excel/officeimo-excel-excelrangescope/#method-numberformat-string)
- Method [ExcelRangeScope.Sheet](/api/excel/officeimo-excel-excelrangescope/#method-sheet-action-officeimo-excel-excelsheet)
- Method [ExcelRangeScope.ShrinkToFit](/api/excel/officeimo-excel-excelrangescope/#method-shrinktofit-boolean)
- Method [ExcelRangeScope.Strikethrough](/api/excel/officeimo-excel-excelrangescope/#method-strikethrough-boolean)
- Method [ExcelRangeScope.Subscript](/api/excel/officeimo-excel-excelrangescope/#method-subscript)
- Method [ExcelRangeScope.Superscript](/api/excel/officeimo-excel-excelrangescope/#method-superscript)
- Method [ExcelRangeScope.TextRotation](/api/excel/officeimo-excel-excelrangescope/#method-textrotation-int32)
- Method [ExcelRangeScope.Underline](/api/excel/officeimo-excel-excelrangescope/#method-underline-officeimo-excel-excelunderlinestyle)
- Method [ExcelRangeScope.Values](/api/excel/officeimo-excel-excelrangescope/#method-values-object-0-0)
- Method [ExcelRangeScope.VerticalAlignment](/api/excel/officeimo-excel-excelrangescope/#method-verticalalignment-officeimo-excel-excelverticalalignment)
- Method [ExcelRangeScope.VerticalTextAlignment](/api/excel/officeimo-excel-excelrangescope/#method-verticaltextalignment-officeimo-excel-excelverticaltextalignment)
- Method [ExcelRangeScope.WrapText](/api/excel/officeimo-excel-excelrangescope/#method-wraptext-boolean)

### Accepted by parameters 1

- Method [ExcelSheetScope.Range](/api/excel/officeimo-excel-excelsheetscope/#method-range-string-action-officeimo-excel-excelrangescope) parameter `configure`

Filter members 

Show inherited

## Methods

`public ExcelRangeScope Baseline()` [#](#method-baseline)

Restores every cell in the range to the normal baseline.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope Bold(bool bold = true)` [#](#method-bold-boolean)

Sets or clears bold font style for every cell in the range.

Parameters

**bold bool = true optional**

The value.

Returns

`ExcelRangeScope` The same scope.

Border 2 overloads

`public ExcelRangeScope Border(ExcelBorderStyle style, OfficeColor? color = null)` [#](#method-border-officeimo-excel-excelborderstyle-nullable-officeimo-officecolor)

Applies a border style to every edge of every cell in the range.

Parameters

**style OfficeIMO.Excel.ExcelBorderStyle required**

The value.

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

The value.

Returns

`ExcelRangeScope` The same scope.

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

Sets selected border edges of every cell in the range while preserving other edges and styles.

Parameters

**borders OfficeIMO.Excel.ExcelCellBorders required**

The value.

**style OfficeIMO.Excel.ExcelBorderStyle required**

The value.

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

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope Cell(int rowOffset, int columnOffset, Action<ExcelCellScope>? configure = null)` [#](#method-cell-int32-int32-action-officeimo-excel-excelcellscope)

Gets an editable cell using one-based offsets from this range's top-left cell.

Parameters

**rowOffset int required**

The value.

**columnOffset int required**

The value.

**configure System.Action<OfficeIMO.Excel.ExcelCellScope>? = null optional**

Configures the new item through its scope.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope Color(OfficeColor color)` [#](#method-color-officeimo-officecolor)

Applies a font color to every cell in the range.

Parameters

**color OfficeIMO.OfficeColor required**

The value.

Returns

`ExcelRangeScope` The same scope.

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

Applies diagonal borders to every cell in the range.

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

`ExcelRangeScope` The same scope.

`public ExcelRangeScope FillColor(OfficeColor color)` [#](#method-fillcolor-officeimo-officecolor)

Applies a solid fill color to every cell in the range. Theme colors stay linked to the workbook theme.

Parameters

**color OfficeIMO.OfficeColor required**

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope FontFamily(string fontFamily)` [#](#method-fontfamily-string)

Applies a font family name to every cell in the range.

Parameters

**fontFamily string required**

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope FontSize(OfficeLength fontSize)` [#](#method-fontsize-officeimo-officelength)

Applies a positive physical font size to every cell in the range.

Parameters

**fontSize OfficeIMO.OfficeLength required**

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope GradientFill(OfficeColor fromColor, OfficeColor toColor, double degree = 0)` [#](#method-gradientfill-officeimo-officecolor-officeimo-officecolor-double)

Applies a two-color linear gradient fill to every cell in the range.

Parameters

**fromColor OfficeIMO.OfficeColor required**

The value.

**toColor OfficeIMO.OfficeColor required**

The value.

**degree double = 0 optional**

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope HorizontalAlignment(ExcelHorizontalAlignment alignment)` [#](#method-horizontalalignment-officeimo-excel-excelhorizontalalignment)

Sets the horizontal alignment of every cell in the range.

Parameters

**alignment OfficeIMO.Excel.ExcelHorizontalAlignment required**

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope Italic(bool italic = true)` [#](#method-italic-boolean)

Sets or clears italic font style for every cell in the range.

Parameters

**italic bool = true optional**

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope NumberFormat(string numberFormat)` [#](#method-numberformat-string)

Applies a number format to every cell in the range.

Parameters

**numberFormat string required**

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope Sheet(Action<ExcelSheet> configure)` [#](#method-sheet-action-officeimo-excel-excelsheet)

Configures [ExcelRange.Sheet](/api/excel/officeimo-excel-excelrange/) in place: Gets the worksheet that owns the range.

Parameters

**configure System.Action<OfficeIMO.Excel.ExcelSheet> required**

Configures the value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope ShrinkToFit(bool shrinkToFit = true)` [#](#method-shrinktofit-boolean)

Sets or clears shrink-to-fit text alignment for every cell in the range.

Parameters

**shrinkToFit bool = true optional**

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope Strikethrough(bool strikethrough = true)` [#](#method-strikethrough-boolean)

Sets or clears strikethrough font style for every cell in the range.

Parameters

**strikethrough bool = true optional**

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope Subscript()` [#](#method-subscript)

Formats every cell in the range as subscript.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope Superscript()` [#](#method-superscript)

Formats every cell in the range as superscript.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope TextRotation(int rotation)` [#](#method-textrotation-int32)

Sets Excel text rotation for every cell in the range.

Parameters

**rotation int required**

The value.

Returns

`ExcelRangeScope` The same scope.

Underline 2 overloads

`public ExcelRangeScope Underline(bool underline = true)` [#](#method-underline-boolean)

Sets or clears single underline font style for every cell in the range.

Parameters

**underline bool = true optional**

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope Underline(ExcelUnderlineStyle underlineStyle)` [#](#method-underline-officeimo-excel-excelunderlinestyle)

Sets the native Excel underline style for every cell in the range.

Parameters

**underlineStyle OfficeIMO.Excel.ExcelUnderlineStyle required**

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope Values(object?[,] values)` [#](#method-values-object-0-0)

Writes a rectangular matrix whose dimensions exactly match this range.

Parameters

**values object?[,] required**

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope VerticalAlignment(ExcelVerticalAlignment alignment)` [#](#method-verticalalignment-officeimo-excel-excelverticalalignment)

Sets the vertical alignment of every cell in the range.

Parameters

**alignment OfficeIMO.Excel.ExcelVerticalAlignment required**

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope VerticalTextAlignment(ExcelVerticalTextAlignment alignment)` [#](#method-verticaltextalignment-officeimo-excel-excelverticaltextalignment)

Sets the native Excel baseline, superscript, or subscript alignment for every cell in the range.

Parameters

**alignment OfficeIMO.Excel.ExcelVerticalTextAlignment required**

The value.

Returns

`ExcelRangeScope` The same scope.

`public ExcelRangeScope WrapText(bool wrapText = true)` [#](#method-wraptext-boolean)

Sets or clears text wrapping for every cell in the range.

Parameters

**wrapText bool = true optional**

The value.

Returns

`ExcelRangeScope` The same scope.

## Inherited Methods

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

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

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

Inherited from object

Returns

`int`

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

Inherited from object

Returns

`Type`

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

Inherited from object

Returns

`string?`

## Properties

`public ExcelRange Model { get; }` [#](#property-model)

The [ExcelRange](/api/excel/officeimo-excel-excelrange/) this scope edits, for plain C# inside a lambda.

<!-- PowerForge markdown artifact sha256:150D22C26D80F2577DDEA910D5B42586F09C5362EF958D5CAF6F04F4BE56E467 -->
