Table of Contents

Interface IXLRange

Namespace
SlapKit.Excel.Excel
Assembly
SlapKit.Excel.dll
public interface IXLRange : IXLRangeBase, IXLAddressable
Inherited Members
Extension Methods

Properties

SortColumns

IXLSortElements SortColumns { get; }

Property Value

IXLSortElements

SortRows

IXLSortElements SortRows { get; }

Property Value

IXLSortElements

Methods

AsTable()

Use this range as a table, but do not add it to the Tables list

IXLTable AsTable()

Returns

IXLTable

Remarks

NOTES:
The AsTable method will use the first row of the range as a header row.
If this range contains only one row, then an empty data row will be inserted into the returned table.

AsTable(string)

Use this range as a table with the passed name, but do not add it to the Tables list

IXLTable AsTable(string name)

Parameters

name string

Table name to be used.

Returns

IXLTable

Remarks

NOTES:
The AsTable method will use the first row of the range as a header row.
If this range contains only one row, then an empty data row will be inserted into the returned table.

Cell(IXLAddress)

Gets the cell at the specified address.

IXLCell Cell(IXLAddress cellAddressInRange)

Parameters

cellAddressInRange IXLAddress

The cell address in the parent range.

Returns

IXLCell

Cell(int, int)

Gets the cell at the specified row and column.

The cell address is relative to the parent range.

IXLCell Cell(int row, int column)

Parameters

row int

The cell's row.

column int

The cell's column.

Returns

IXLCell

Cell(int, string)

Gets the cell at the specified row and column.

The cell address is relative to the parent range.

IXLCell Cell(int row, string column)

Parameters

row int

The cell's row.

column string

The cell's column.

Returns

IXLCell

Cell(string)

Gets the cell at the specified address.

IXLCell Cell(string cellAddressInRange)

Parameters

cellAddressInRange string

The cell address in the parent range.

Returns

IXLCell

Clear(XLClearOptions)

Clears the contents of this range.

IXLRange Clear(XLClearOptions clearOptions = XLClearOptions.All)

Parameters

clearOptions XLClearOptions

Specify what you want to clear.

Returns

IXLRange

Column(int)

Gets the specified column of the range.

IXLRangeColumn Column(int columnNumber)

Parameters

columnNumber int

1-based column number relative to the first column of this range.

Returns

IXLRangeColumn

The relevant column

Column(string)

Gets the specified column of the range.

IXLRangeColumn Column(string columnLetter)

Parameters

columnLetter string

Column letter.

Returns

IXLRangeColumn

ColumnCount()

Gets the number of columns in this range.

int ColumnCount()

Returns

int

Columns(Func<IXLRangeColumn, bool>)

Gets a collection of all columns in this range.

IXLRangeColumns Columns(Func<IXLRangeColumn, bool> predicate = null)

Parameters

predicate Func<IXLRangeColumn, bool>

Returns

IXLRangeColumns

Columns(int, int)

Gets a collection of the specified columns in this range.

IXLRangeColumns Columns(int firstColumn, int lastColumn)

Parameters

firstColumn int

The first column to return. 1-based column number relative to the first column of this range.

lastColumn int

The last column to return. 1-based column number relative to the first column of this range.

Returns

IXLRangeColumns

Columns(string)

Gets a collection of the specified columns in this range, separated by commas.

e.g. Columns("G:H"), Columns("10:11,13:14"), Columns("P:Q,S:T"), Columns("V")

IXLRangeColumns Columns(string columns)

Parameters

columns string

The columns to return.

Returns

IXLRangeColumns

Columns(string, string)

Gets a collection of the specified columns in this range.

IXLRangeColumns Columns(string firstColumn, string lastColumn)

Parameters

firstColumn string

The first column to return.

lastColumn string

The last column to return.

Returns

IXLRangeColumns

The relevant columns

ColumnsUsed(XLCellsUsedOptions, Func<IXLRangeColumn, bool>)

IXLRangeColumns ColumnsUsed(XLCellsUsedOptions options, Func<IXLRangeColumn, bool> predicate = null)

Parameters

options XLCellsUsedOptions
predicate Func<IXLRangeColumn, bool>

Returns

IXLRangeColumns

ColumnsUsed(Func<IXLRangeColumn, bool>)

IXLRangeColumns ColumnsUsed(Func<IXLRangeColumn, bool> predicate = null)

Parameters

predicate Func<IXLRangeColumn, bool>

Returns

IXLRangeColumns

CopyTo(IXLCell)

IXLRange CopyTo(IXLCell target)

Parameters

target IXLCell

Returns

IXLRange

CopyTo(IXLRangeBase)

IXLRange CopyTo(IXLRangeBase target)

Parameters

target IXLRangeBase

Returns

IXLRange

CreateTable()

IXLTable CreateTable()

Returns

IXLTable

CreateTable(string)

IXLTable CreateTable(string name)

Parameters

name string

Returns

IXLTable

Delete(XLShiftDeletedCells)

Deletes this range and shifts the surrounding cells accordingly.

void Delete(XLShiftDeletedCells shiftDeleteCells)

Parameters

shiftDeleteCells XLShiftDeletedCells

How to shift the surrounding cells.

FindColumn(Func<IXLRangeColumn, bool>)

Returns the first row that matches the given predicate

IXLRangeColumn FindColumn(Func<IXLRangeColumn, bool> predicate)

Parameters

predicate Func<IXLRangeColumn, bool>

Returns

IXLRangeColumn

FindRow(Func<IXLRangeRow, bool>)

Returns the first row that matches the given predicate

IXLRangeRow FindRow(Func<IXLRangeRow, bool> predicate)

Parameters

predicate Func<IXLRangeRow, bool>

Returns

IXLRangeRow

FirstColumn(Func<IXLRangeColumn, bool>)

Gets the first column of the range.

IXLRangeColumn FirstColumn(Func<IXLRangeColumn, bool> predicate = null)

Parameters

predicate Func<IXLRangeColumn, bool>

Returns

IXLRangeColumn

FirstColumnUsed(XLCellsUsedOptions, Func<IXLRangeColumn, bool>)

Gets the first non-empty column of the range that contains a cell with a value.

IXLRangeColumn FirstColumnUsed(XLCellsUsedOptions options, Func<IXLRangeColumn, bool> predicate = null)

Parameters

options XLCellsUsedOptions

The options to determine whether a cell is used.

predicate Func<IXLRangeColumn, bool>

The predicate to choose cells.

Returns

IXLRangeColumn

FirstColumnUsed(Func<IXLRangeColumn, bool>)

IXLRangeColumn FirstColumnUsed(Func<IXLRangeColumn, bool> predicate = null)

Parameters

predicate Func<IXLRangeColumn, bool>

Returns

IXLRangeColumn

FirstRow(Func<IXLRangeRow, bool>)

Gets the first row of the range.

IXLRangeRow FirstRow(Func<IXLRangeRow, bool> predicate = null)

Parameters

predicate Func<IXLRangeRow, bool>

Returns

IXLRangeRow

FirstRowUsed(XLCellsUsedOptions, Func<IXLRangeRow, bool>)

Gets the first non-empty row of the range that contains a cell with a value.

IXLRangeRow FirstRowUsed(XLCellsUsedOptions options, Func<IXLRangeRow, bool> predicate = null)

Parameters

options XLCellsUsedOptions

The options to determine whether a cell is used.

predicate Func<IXLRangeRow, bool>

The predicate to choose cells.

Returns

IXLRangeRow

FirstRowUsed(Func<IXLRangeRow, bool>)

IXLRangeRow FirstRowUsed(Func<IXLRangeRow, bool> predicate = null)

Parameters

predicate Func<IXLRangeRow, bool>

Returns

IXLRangeRow

InsertColumnsAfter(int)

Inserts X number of columns to the right of this range.

All cells to the right of this range will be shifted X number of columns.

IXLRangeColumns InsertColumnsAfter(int numberOfColumns)

Parameters

numberOfColumns int

Number of columns to insert.

Returns

IXLRangeColumns

InsertColumnsAfter(int, bool)

IXLRangeColumns InsertColumnsAfter(int numberOfColumns, bool expandRange)

Parameters

numberOfColumns int
expandRange bool

Returns

IXLRangeColumns

InsertColumnsBefore(int)

Inserts X number of columns to the left of this range.

This range and all cells to the right of this range will be shifted X number of columns.

IXLRangeColumns InsertColumnsBefore(int numberOfColumns)

Parameters

numberOfColumns int

Number of columns to insert.

Returns

IXLRangeColumns

InsertColumnsBefore(int, bool)

IXLRangeColumns InsertColumnsBefore(int numberOfColumns, bool expandRange)

Parameters

numberOfColumns int
expandRange bool

Returns

IXLRangeColumns

InsertRowsAbove(int)

Inserts X number of rows on top of this range.

This range and all cells below this range will be shifted X number of rows.

IXLRangeRows InsertRowsAbove(int numberOfRows)

Parameters

numberOfRows int

Number of rows to insert.

Returns

IXLRangeRows

InsertRowsAbove(int, bool)

IXLRangeRows InsertRowsAbove(int numberOfRows, bool expandRange)

Parameters

numberOfRows int
expandRange bool

Returns

IXLRangeRows

InsertRowsBelow(int)

Inserts X number of rows below this range.

All cells below this range will be shifted X number of rows.

IXLRangeRows InsertRowsBelow(int numberOfRows)

Parameters

numberOfRows int

Number of rows to insert.

Returns

IXLRangeRows

InsertRowsBelow(int, bool)

IXLRangeRows InsertRowsBelow(int numberOfRows, bool expandRange)

Parameters

numberOfRows int
expandRange bool

Returns

IXLRangeRows

LastColumn(Func<IXLRangeColumn, bool>)

Gets the last column of the range.

IXLRangeColumn LastColumn(Func<IXLRangeColumn, bool> predicate = null)

Parameters

predicate Func<IXLRangeColumn, bool>

Returns

IXLRangeColumn

LastColumnUsed(XLCellsUsedOptions, Func<IXLRangeColumn, bool>)

Gets the last non-empty column of the range that contains a cell with a value.

IXLRangeColumn LastColumnUsed(XLCellsUsedOptions options, Func<IXLRangeColumn, bool> predicate = null)

Parameters

options XLCellsUsedOptions

The options to determine whether a cell is used.

predicate Func<IXLRangeColumn, bool>

The predicate to choose cells.

Returns

IXLRangeColumn

LastColumnUsed(Func<IXLRangeColumn, bool>)

IXLRangeColumn LastColumnUsed(Func<IXLRangeColumn, bool> predicate = null)

Parameters

predicate Func<IXLRangeColumn, bool>

Returns

IXLRangeColumn

LastRow(Func<IXLRangeRow, bool>)

Gets the last row of the range.

IXLRangeRow LastRow(Func<IXLRangeRow, bool> predicate = null)

Parameters

predicate Func<IXLRangeRow, bool>

Returns

IXLRangeRow

LastRowUsed(XLCellsUsedOptions, Func<IXLRangeRow, bool>)

Gets the last non-empty row of the range that contains a cell with a value.

IXLRangeRow LastRowUsed(XLCellsUsedOptions options, Func<IXLRangeRow, bool> predicate = null)

Parameters

options XLCellsUsedOptions

The options to determine whether a cell is used.

predicate Func<IXLRangeRow, bool>

The predicate to choose cells.

Returns

IXLRangeRow

LastRowUsed(Func<IXLRangeRow, bool>)

IXLRangeRow LastRowUsed(Func<IXLRangeRow, bool> predicate = null)

Parameters

predicate Func<IXLRangeRow, bool>

Returns

IXLRangeRow

Range(IXLAddress, IXLAddress)

Returns the specified range.

IXLRange Range(IXLAddress firstCellAddress, IXLAddress lastCellAddress)

Parameters

firstCellAddress IXLAddress

The first cell address in the range.

lastCellAddress IXLAddress

The last cell address in the range.

Returns

IXLRange

Range(IXLCell, IXLCell)

Returns the specified range.

IXLRange Range(IXLCell firstCell, IXLCell lastCell)

Parameters

firstCell IXLCell

The first cell in the range.

lastCell IXLCell

The last cell in the range.

Returns

IXLRange

Range(IXLRangeAddress)

Returns the specified range.

IXLRange Range(IXLRangeAddress rangeAddress)

Parameters

rangeAddress IXLRangeAddress

The range boundaries.

Returns

IXLRange

Range(int, int, int, int)

Returns the specified range.

IXLRange Range(int firstCellRow, int firstCellColumn, int lastCellRow, int lastCellColumn)

Parameters

firstCellRow int

The first cell's row of the range to return.

firstCellColumn int

The first cell's column of the range to return.

lastCellRow int

The last cell's row of the range to return.

lastCellColumn int

The last cell's column of the range to return.

Returns

IXLRange

.

Range(string)

Returns the specified range.

IXLRange Range(string rangeAddress)

Parameters

rangeAddress string

The range boundaries.

Returns

IXLRange

Range(string, string)

Returns the specified range.

IXLRange Range(string firstCellAddress, string lastCellAddress)

Parameters

firstCellAddress string

The first cell address in the range.

lastCellAddress string

The last cell address in the range.

Returns

IXLRange

RangeUsed()

IXLRange RangeUsed()

Returns

IXLRange

Ranges(string)

Returns a collection of ranges, separated by commas.

IXLRanges Ranges(string ranges)

Parameters

ranges string

The ranges to return.

Returns

IXLRanges

Row(int)

Gets the specified row of the range.

IXLRangeRow Row(int row)

Parameters

row int

1-based row number relative to the first row of this range.

Returns

IXLRangeRow

The relevant row

RowCount()

Gets the number of rows in this range.

int RowCount()

Returns

int

Rows(Func<IXLRangeRow, bool>)

IXLRangeRows Rows(Func<IXLRangeRow, bool> predicate = null)

Parameters

predicate Func<IXLRangeRow, bool>

Returns

IXLRangeRows

Rows(int, int)

Gets a collection of the specified rows in this range.

IXLRangeRows Rows(int firstRow, int lastRow)

Parameters

firstRow int

The first row to return. 1-based row number relative to the first row of this range.

lastRow int

The last row to return. 1-based row number relative to the first row of this range.

Returns

IXLRangeRows

Rows(string)

Gets a collection of the specified rows in this range, separated by commas.

e.g. Rows("4:5"), Rows("7:8,10:11"), Rows("13")

IXLRangeRows Rows(string rows)

Parameters

rows string

The rows to return.

Returns

IXLRangeRows

RowsUsed(XLCellsUsedOptions, Func<IXLRangeRow, bool>)

IXLRangeRows RowsUsed(XLCellsUsedOptions options, Func<IXLRangeRow, bool> predicate = null)

Parameters

options XLCellsUsedOptions
predicate Func<IXLRangeRow, bool>

Returns

IXLRangeRows

RowsUsed(Func<IXLRangeRow, bool>)

IXLRangeRows RowsUsed(Func<IXLRangeRow, bool> predicate = null)

Parameters

predicate Func<IXLRangeRow, bool>

Returns

IXLRangeRows

Sort()

IXLRange Sort()

Returns

IXLRange

Sort(int, XLSortOrder, bool, bool)

IXLRange Sort(int columnToSortBy, XLSortOrder sortOrder = XLSortOrder.Ascending, bool matchCase = false, bool ignoreBlanks = true)

Parameters

columnToSortBy int
sortOrder XLSortOrder
matchCase bool
ignoreBlanks bool

Returns

IXLRange

Sort(string, XLSortOrder, bool, bool)

IXLRange Sort(string columnsToSortBy, XLSortOrder sortOrder = XLSortOrder.Ascending, bool matchCase = false, bool ignoreBlanks = true)

Parameters

columnsToSortBy string
sortOrder XLSortOrder
matchCase bool
ignoreBlanks bool

Returns

IXLRange

SortLeftToRight(XLSortOrder, bool, bool)

IXLRange SortLeftToRight(XLSortOrder sortOrder = XLSortOrder.Ascending, bool matchCase = false, bool ignoreBlanks = true)

Parameters

sortOrder XLSortOrder
matchCase bool
ignoreBlanks bool

Returns

IXLRange

Transpose(XLTransposeOptions)

Transposes the contents and styles of all cells in this range.

void Transpose(XLTransposeOptions transposeOption)

Parameters

transposeOption XLTransposeOptions

How to handle the surrounding cells when transposing the range.