Class CompositeRange
Represents a range composed of multiple simple ranges that may be non-contiguous.
Inherited Members
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public class CompositeRange : Range, INotifyPropertyChanged, IEnumerable<object>, IEnumerable
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
Examples
// Create a composite range from two separate cell ranges
var range1 = worksheet.Cells["A1:B2"];
var range2 = worksheet.Cells["D4:E5"];
var composite = new CompositeRange(new[] { range1, range2 });
Constructors
CompositeRange(IEnumerable<SimpleRange>)
Initializes a new CompositeRange from the specified collection of simple ranges.
Declaration
public CompositeRange(IEnumerable<SimpleRange> ranges)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<SimpleRange> | ranges | The collection of simple ranges that compose this range. |
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |
Properties
ColumnCount
Gets the number of columns in the first constituent range.
Declaration
public override int ColumnCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
IsFullColumn
Gets a value indicating whether this range represents a full column.
Declaration
public override bool IsFullColumn { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
IsFullRow
Gets a value indicating whether this range represents a full row.
Declaration
public override bool IsFullRow { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
this[int, int]
Gets the cell at the specified row and column indices.
Declaration
public override Cell this[int row, int column] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | row | The row index. |
| int | column | The column index. |
Property Value
| Type | Description |
|---|---|
| Cell | The cell at the specified position. |
Overrides
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
Exceptions
| Type | Condition |
|---|---|
| NotImplementedException | This property is not supported for composite ranges. |
Label
Gets the label representation of this composite range.
Declaration
public override string Label { get; }
Property Value
| Type | Description |
|---|---|
| string |
Overrides
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
Ranges
Gets the list of simple ranges that compose this composite range.
Declaration
public List<SimpleRange> Ranges { get; }
Property Value
| Type | Description |
|---|---|
| List<SimpleRange> |
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
RowCount
Gets the number of rows in the first constituent range.
Declaration
public override int RowCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
TopLeftCell
Gets the top-left cell of the first constituent range.
Declaration
public override Cell TopLeftCell { get; }
Property Value
| Type | Description |
|---|---|
| Cell |
Overrides
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
Worksheet
Gets the worksheet containing this composite range.
Declaration
public override Worksheet Worksheet { get; }
Property Value
| Type | Description |
|---|---|
| Worksheet |
Overrides
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
Methods
Equals(Range)
Determines whether this composite range equals another range.
Declaration
public override bool Equals(Range r)
Parameters
| Type | Name | Description |
|---|---|---|
| Range | r | The range to compare with. |
Returns
| Type | Description |
|---|---|
| bool |
|
Overrides
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
GetAllCells()
Gets all cells in this composite range.
Declaration
public override IEnumerable<Cell> GetAllCells()
Returns
| Type | Description |
|---|---|
| IEnumerable<Cell> | An enumerable of all cells across all constituent ranges. |
Overrides
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
GetColumns()
Gets the distinct columns spanned by this composite range.
Declaration
public override IEnumerable<Column> GetColumns()
Returns
| Type | Description |
|---|---|
| IEnumerable<Column> | An enumerable of distinct columns. |
Overrides
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
GetRows()
Gets the distinct rows spanned by this composite range.
Declaration
public override IEnumerable<Row> GetRows()
Returns
| Type | Description |
|---|---|
| IEnumerable<Row> | An enumerable of distinct rows. |
Overrides
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
SetBorder(Border, BorderType)
Sets the border for all constituent ranges in this composite range.
Declaration
public override void SetBorder(Border border, BorderType borderType)
Parameters
| Type | Name | Description |
|---|---|---|
| Border | border | The border to apply. |
| BorderType | borderType | The type of border to set. |
Overrides
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.
SetStyle(CellStyle)
Sets the cell style for all constituent ranges in this composite range.
Declaration
public override void SetStyle(CellStyle cellStyle)
Parameters
| Type | Name | Description |
|---|---|---|
| CellStyle | cellStyle | The cell style to apply. |
Overrides
Remarks
CompositeRange is used when a range operation needs to span multiple disjoint areas.
For example, when a user selects multiple non-contiguous ranges, they are represented as a composite range.
This class inherits from Range and provides implementations that delegate operations to each constituent simple range.