• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class Range

Represents a set of cells in a worksheet.

Inheritance
object
Range
CompositeRange
SimpleRange
Implements
INotifyPropertyChanged
IEnumerable<object>
IEnumerable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public abstract class Range : INotifyPropertyChanged, IEnumerable<object>, IEnumerable
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges
Examples
// Get a range and set values
var range = worksheet.Cells["A1:B2"];
range.SetValue(new object[,] { { 1, 2 }, { 3, 4 } });

// Apply formatting
range.Background = CellFill.Solid(Color.LightBlue);
range.Font.Bold = true;

Constructors

Range()

Initializes a new instance of the Range class.

Declaration
protected Range()
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Properties

AbsoluteLabel

Gets the absolute A1-style label (address) of the range, including the worksheet name.

Declaration
public string AbsoluteLabel { get; }
Property Value
Type Description
string
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Background

Get or set the background of the range.

Declaration
public CellFill Background { get; set; }
Property Value
Type Description
CellFill
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

CellCount

Gets the total number of cells in this range.

Declaration
public int CellCount { get; }
Property Value
Type Description
int
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

ColumnCount

Gets the count of columns of the range.

Declaration
public abstract int ColumnCount { get; }
Property Value
Type Description
int
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Fill

Gets the fill for a Range.

Declaration
public RangeFill Fill { get; }
Property Value
Type Description
RangeFill
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

FirstColumnIndex

Gets the first column index of the range.

Declaration
public virtual int FirstColumnIndex { get; }
Property Value
Type Description
int
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

FirstRowIndex

Gets the first row index of the range.

Declaration
public virtual int FirstRowIndex { get; }
Property Value
Type Description
int
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Font

Gets the font settings for cells in this range.

Declaration
public RangeFont Font { get; }
Property Value
Type Description
RangeFont
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Foreground

Get or set the foregroung color of the range.

Declaration
public SpreadsheetColor Foreground { get; set; }
Property Value
Type Description
SpreadsheetColor
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Format

Get or set the format for this range.

Declaration
public Format Format { get; set; }
Property Value
Type Description
Format
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

FullAbsoluteLabel

Gets the full absolute label including the worksheet name and absolute address.

Declaration
public string FullAbsoluteLabel { get; }
Property Value
Type Description
string
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

FullLabel

Gets the full label including the worksheet name and address.

Declaration
public string FullLabel { get; }
Property Value
Type Description
string
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

HorizontalAlignment

Specifies the horizontal alignment for cells in this range.

Declaration
public HorizontalCellAlignment? HorizontalAlignment { get; set; }
Property Value
Type Description
HorizontalCellAlignment?
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

IsFullColumn

Gets a value indicating whether this range spans entire columns.

Declaration
public abstract bool IsFullColumn { get; }
Property Value
Type Description
bool
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

IsFullRow

Gets a value indicating whether this range spans entire rows.

Declaration
public abstract bool IsFullRow { get; }
Property Value
Type Description
bool
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

IsLocked

Set or get whether the cell is locked and cannot be edited. This value of this property is meaningful only if the sheet is protected.

Declaration
public bool? IsLocked { get; set; }
Property Value
Type Description
bool?
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

this[int]

Gets a cell from a range with the specified index.

Declaration
public Cell this[int index] { get; }
Parameters
Type Name Description
int index

The zero-based index of the cell within the range.

Property Value
Type Description
Cell

The cell at the specified index.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

this[int, int]

Gets the cell at the specified row and column indices.

Declaration
public abstract Cell this[int row, int column] { get; }
Parameters
Type Name Description
int row

The row index (0-based).

int column

The column index (0-based).

Property Value
Type Description
Cell

The cell at the specified position.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Label

Gets the A1-style label (address) of the range.

Declaration
public abstract string Label { get; }
Property Value
Type Description
string
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

NameOrLabel

Gets the name of the range if it has one, otherwise returns the label.

Declaration
public string NameOrLabel { get; }
Property Value
Type Description
string
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

RowCount

Gets the count of rows of the range.

Declaration
public abstract int RowCount { get; }
Property Value
Type Description
int
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

TopLeftCell

Get the cell in the top left corner of the range

Declaration
public abstract Cell TopLeftCell { get; }
Property Value
Type Description
Cell
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

VerticalAlignment

Get or set the vertical of cells in this range.

Declaration
public VerticalCellAlignment? VerticalAlignment { get; set; }
Property Value
Type Description
VerticalCellAlignment?
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Worksheet

Get the sheet which contains this range.

Declaration
public abstract Worksheet Worksheet { get; }
Property Value
Type Description
Worksheet
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

WrapText

Get or set the text wrapping of cells in this range.

Declaration
public bool? WrapText { get; set; }
Property Value
Type Description
bool?
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Methods

CleanText(TextCleansingOptions)

Exposes the clean text associated with Range.

Declaration
public TextCleansingResult CleanText(TextCleansingOptions options)
Parameters
Type Name Description
TextCleansingOptions options

The options used by the operation.

Returns
Type Description
TextCleansingResult

The clean text returned by the operation.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Clear()

Clear all content and formatting from the range.

Declaration
public void Clear()
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

ClearBorders()

Clear all borders from the range

Declaration
public void ClearBorders()
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

ClearComments()

Clear all the comments from the range

Declaration
public void ClearComments()
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

ClearContents()

Clear the values and formula from the range

Declaration
public void ClearContents()
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

ClearFormats()

Clear all formats from the range

Declaration
public void ClearFormats()
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

ClearHyperlinks()

Clear all hyperlinks from the range.

Declaration
public void ClearHyperlinks()
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

CopyFrom(Range, PasteOptions)

Copies data from the source range to this range using the specified paste options.

Declaration
public void CopyFrom(Range source, PasteOptions pasteOptions)
Parameters
Type Name Description
Range source

The source range to copy from.

PasteOptions pasteOptions

The paste options specifying how to paste the data.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

DeleteEmptyColumns(DeleteEmptyColumnsOptions)

Removes the selected empty columns from the Range.

Declaration
public int DeleteEmptyColumns(DeleteEmptyColumnsOptions options = null)
Parameters
Type Name Description
DeleteEmptyColumnsOptions options

The options used by the operation.

Returns
Type Description
int

The delete empty columns returned by the operation.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

DeleteEmptyRows(DeleteEmptyRowsOptions)

Removes the selected empty rows from the Range.

Declaration
public int DeleteEmptyRows(DeleteEmptyRowsOptions options = null)
Parameters
Type Name Description
DeleteEmptyRowsOptions options

The options used by the operation.

Returns
Type Description
int

The delete empty rows returned by the operation.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Equals(Range)

Determines whether this range is equal to another range.

Declaration
public virtual bool Equals(Range r)
Parameters
Type Name Description
Range r

The range to compare with.

Returns
Type Description
bool

true if the ranges are equal; otherwise, false.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

FindAll(FindArguments)

Finds all cells within the range that match the specified search arguments.

Declaration
public IEnumerable<Cell> FindAll(FindArguments arguments)
Parameters
Type Name Description
FindArguments arguments

The search arguments specifying what to find.

Returns
Type Description
IEnumerable<Cell>

An enumerable collection of cells matching the search criteria.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

GetAllCells()

Enumerates all the cells in the current range

Declaration
public abstract IEnumerable<Cell> GetAllCells()
Returns
Type Description
IEnumerable<Cell>

The cells

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

GetColumns()

Gets the columns that make up this range.

Declaration
public abstract IEnumerable<Column> GetColumns()
Returns
Type Description
IEnumerable<Column>

An enumerable collection of columns in this range.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

GetRows()

Gets the rows that make up this range.

Declaration
public abstract IEnumerable<Row> GetRows()
Returns
Type Description
IEnumerable<Row>

An enumerable collection of rows in this range.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Intersection(Range, Range)

Gets the intersection of two ranges.

Declaration
public static Range Intersection(Range range1, Range range2)
Parameters
Type Name Description
Range range1
Range range2
Returns
Type Description
Range
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Intersects(Range, Range)

Determines whether two ranges intersect (overlap).

Declaration
public static bool Intersects(Range range1, Range range2)
Parameters
Type Name Description
Range range1

The first range.

Range range2

The second range.

Returns
Type Description
bool

true if the ranges intersect; otherwise, false.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Merge()

Merges the cells in the range.

Declaration
public void Merge()
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

RemoveDuplicates(RemoveDuplicatesOptions)

Removes the selected duplicates from the Range.

Declaration
public RemoveDuplicatesResult RemoveDuplicates(RemoveDuplicatesOptions options = null)
Parameters
Type Name Description
RemoveDuplicatesOptions options

The options used by the operation.

Returns
Type Description
RemoveDuplicatesResult

The remove duplicates returned by the operation.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

ReplaceAll(ReplaceArguments)

Replaces all occurrences within the range that match the specified replace arguments.

Declaration
public void ReplaceAll(ReplaceArguments arguments)
Parameters
Type Name Description
ReplaceArguments arguments

The replace arguments specifying what to replace and with what.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

SetArrayFormula(string)

Set the array formula of the range.

Declaration
public void SetArrayFormula(string text)
Parameters
Type Name Description
string text

The text of the array formula. The text of the formula should not be localized

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

SetArrayFormula(string, bool)

Set the array formula of the range.

Declaration
public void SetArrayFormula(string text, bool localized)
Parameters
Type Name Description
string text

The text of the array formula

bool localized

Specifies whether the text is localized

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

SetBorder(Border, BorderType)

Set the border for a given range edge

Declaration
public abstract void SetBorder(Border border, BorderType borderType)
Parameters
Type Name Description
Border border

The value of the border to set

BorderType borderType

The type of border to set

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

SetColumnsWidthPixel(double)

Sets the width of all columns in this range to the specified value in pixels.

Declaration
public virtual void SetColumnsWidthPixel(double w)
Parameters
Type Name Description
double w

The width in pixels.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

SetFormula(string)

Updates the formula held by the Range.

Declaration
public void SetFormula(string formula)
Parameters
Type Name Description
string formula

The formula used by the operation.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

SetFormula(string[])

Updates the formula held by the Range.

Declaration
public void SetFormula(string[] formulas)
Parameters
Type Name Description
string[] formulas

The formulas used by the operation.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

SetRowsHeight(double)

Sets the height of all rows in this range to the specified value in points.

Declaration
public virtual void SetRowsHeight(double value)
Parameters
Type Name Description
double value

The height in points.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

SetStyle(CellStyle)

Set the style of the range. This method extracts the properties of the style and applies them to all cells and dimensions in the current range.

Declaration
public abstract void SetStyle(CellStyle style)
Parameters
Type Name Description
CellStyle style

The style to apply

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges
Exceptions
Type Condition
ArgumentNullException

SetValue(ErrorType[])

Sets error values for all cells in this range from an array.

Declaration
public void SetValue(ErrorType[] values)
Parameters
Type Name Description
ErrorType[] values

Array of ErrorType values matching the cell count.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges
Exceptions
Type Condition
ArgumentException

Thrown when the values array length does not match the cell count.

SetValue(DateTime[])

Sets DateTime values for all cells in this range from an array.

Declaration
public void SetValue(DateTime[] values)
Parameters
Type Name Description
DateTime[] values

Array of DateTime values matching the cell count.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges
Exceptions
Type Condition
ArgumentException

Thrown when the values array length does not match the cell count.

SetValue(double[])

Sets double values for all cells in this range from an array.

Declaration
public void SetValue(double[] values)
Parameters
Type Name Description
double[] values

Array of double values matching the cell count.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges
Exceptions
Type Condition
ArgumentException

Thrown when the values array length does not match the cell count.

SetValue(int[])

Sets integer values for all cells in this range from an array.

Declaration
public void SetValue(int[] values)
Parameters
Type Name Description
int[] values

Array of integer values matching the cell count.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges
Exceptions
Type Condition
ArgumentException

Thrown when the values array length does not match the cell count.

SetValue(object)

Sets the value for all cells in this range.

Declaration
public void SetValue(object value)
Parameters
Type Name Description
object value

The value to set.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

SetValue(object[,])

Sets values for all cells in this range from a 2D array.

Declaration
public void SetValue(object[,] values)
Parameters
Type Name Description
object[,] values

2D array of values to set.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

SetValue(object[])

Sets values for all cells in this range from a 1D array.

Declaration
public void SetValue(object[] values)
Parameters
Type Name Description
object[] values

Array of values matching the cell count.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges
Exceptions
Type Condition
ArgumentException

Thrown when the values array length does not match the cell count.

Sort()

Sort the row values in ascending order. Top-Down.

Declaration
public void Sort()
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Sort(SortOrder)

Sorts the range by the specified sort order.

Declaration
public void Sort(SortOrder order)
Parameters
Type Name Description
SortOrder order

The sort order (ascending or descending).

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Sort(SortOrder, SortOrientation)

Sorts the range by the specified sort order and orientation.

Declaration
public void Sort(SortOrder order, SortOrientation orientation)
Parameters
Type Name Description
SortOrder order

The sort order (ascending or descending).

SortOrientation orientation

The sort orientation (row or column).

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

ToString()

Returns the label (A1-style address) of the range.

Declaration
public override sealed string ToString()
Returns
Type Description
string
Overrides
object.ToString()
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Union(Range, Range)

Creates a union of two ranges, combining their cells.

Declaration
public static Range Union(Range range1, Range range2)
Parameters
Type Name Description
Range range1

The first range.

Range range2

The second range.

Returns
Type Description
Range

A new range representing the union of the two input ranges.

Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Events

PropertyChanged

Occurs when a property value changes.

Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type Description
PropertyChangedEventHandler
Remarks

The Range class is the base abstraction for all range types in the spreadsheet model. It provides the fundamental operations for working with cell ranges, including value manipulation, formatting, formula handling, and range operations like union and intersection.

This is an abstract class. Concrete implementations include:

  • CellsRange - Standard rectangular cell ranges
  • FullRowRange - Ranges spanning entire rows
  • FullColumnRange - Ranges spanning entire columns
  • CompositeRange - Non-contiguous ranges composed of multiple simple ranges

Implements

INotifyPropertyChanged
IEnumerable<T>
IEnumerable

Extension Methods

SortingExtensions.Sort(Range, bool)
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX