Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+
Row

Range Interface

Defines a range of cells and serves as the base for the Cell, CellCollection, Column and Row interfaces.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.1.Core.dll

Declaration

public interface Range :
    Formatting,
    IEnumerable<Cell>,
    IEnumerable

The following members return Range objects:

Show 81 links
Library Related API Members
WinForms Controls SpreadsheetControl.SelectedCell
SpreadsheetControl.Selection
SpreadsheetControl.VisibleRange
SpreadsheetControl.VisibleUnfrozenRange
WPF Controls SpreadsheetControl.SelectedCell
SpreadsheetControl.Selection
SpreadsheetControl.VisibleRange
SpreadsheetControl.VisibleUnfrozenRange
Office File API AfterDropRangeEventArgs.SourceRange
AfterDropRangeEventArgs.TargetRange
AfterFillRangeEventArgs.SourceRange
AfterFillRangeEventArgs.TargetRange
ArrayFormula.Range
AutoFilterBase.Range
BeforeDragRangeEventArgs.Range
BeforeDropRangeEventArgs.SourceRange
BeforeDropRangeEventArgs.TargetRange
BeforeFillRangeEventArgs.SourceRange
BeforeFillRangeEventArgs.TargetRange
Cell.GetArrayFormulaRange()
ChartData.RangeValue
ChartObject.GetDataRange()
ChartText.Range
ConditionalFormatting.Range
CopiedRangePastedEventArgs.SourceRange
CopiedRangePastedEventArgs.TargetRange
CopiedRangePastingEventArgs.TargetRange
CustomCellInplaceEditor.Range
DataTableExporter.Range
DataValidation.Range
DefinedName.Range
Hyperlink.Range
HyperlinkClickEventArgs.TargetRange
IgnoredError.Range
IRangeProvider.FromLTRB(Int32, Int32, Int32, Int32)
IRangeProvider.Item[String]
IRangeProvider.Parse(String, ReferenceStyle)
IRangeProvider.Parse(String)
IRangeProvider.Union(IEnumerable<Range>)
IRangeProvider.Union(Range[])
PanesFrozenEventArgs.TopLeft
ParameterValue.RangeValue
PivotCache.SourceRange
PivotLocation.ColumnRange
PivotLocation.DataRange
PivotLocation.PageRange
PivotLocation.Range
PivotLocation.RowRange
PivotLocation.WholeRange
ProtectedRange.Range
Range.CurrentRegion
Range.Exclude(Range)
Range.GetMinimumCover()
Range.GetRangeWithAbsoluteReference()
Range.GetRangeWithRelativeReference()
Range.Intersect(Range)
Range.Offset(Int32, Int32)
Range.Union(Range)
RangeCopyingEventArgs.Range
Sparkline.DataRange
Sparkline.Position
SparklineGroup.DateRange
SparklineGroup.Position
Table.DataRange
Table.HeaderRowRange
Table.Range
Table.TotalRowRange
TableColumn.DataRange
TableColumn.Range
TableColumn.Total
ValueObject.RangeValue
Worksheet.GetDataRange()
Worksheet.GetPrintableRange()
Worksheet.GetPrintableRange(Boolean)
Worksheet.GetUsedRange()
Worksheet.Item[String]
Worksheet.SelectedCell
Worksheet.Selection
WorksheetDataBinding.Range
WorksheetPrintTitleOptions.Columns
WorksheetPrintTitleOptions.Rows

Remarks

The Range interface provides the basic functionality to work with worksheet cells, cell ranges and rows and columns. Refer to the Cells and Formatting Cells sections for examples on how to manage data in cells and change cell appearance.

Example

This example demonstrates how to access ranges of cells in a worksheet. There are several ways to accomplish this.

// A range that includes cells from the top left cell (A1) to the bottom right cell (B5).
Range rangeA1B5 = worksheet["A1:B5"];

// A rectangular range that includes cells from the top left cell (C5) to the bottom right cell (E7).
Range rangeC5E7 = worksheet["C5:E7"];

// The C4:E7 cell range located in the "Sheet3" worksheet.
Range rangeSheet3C4E7 = workbook.Range["Sheet3!C4:E7"];

// A range that contains a single cell (E7).
Range rangeE7 = worksheet["E7"];

// A range that includes the entire column A.
Range rangeColumnA = worksheet["A:A"];

// A range that includes the entire row 5.
Range rangeRow5 = worksheet["5:5"];

// A minimal rectangular range that includes all listed cells: C6, D9 and E7.
Range rangeC6D9E7 = worksheet.Range.Parse("C6:D9:E7");

// A rectangular range whose left column index is 0, top row index is 0, 
// right column index is 3 and bottom row index is 2. This is the A1:D3 cell range.
Range rangeA1D3 = worksheet.Range.FromLTRB(0, 0, 3, 2);

// A range that includes the intersection of two ranges: C5:E10 and E9:G13. 
// This is the E9:E10 cell range.
Range rangeE9E10 = worksheet["C5:E10 E9:G13"];

// Create a defined name for the D20:G23 cell range.
worksheet.DefinedNames.Add("MyNamedRange", "Sheet1!$D$20:$G$23");
// Access a range by its defined name.
Range rangeD20G23 = worksheet["MyNamedRange"];
Range rangeA1D4 = worksheet["A1:D4"];
Range rangeD5E7 = worksheet["D5:E7"];
Range rangeRow11 = worksheet["11:11"];
Range rangeF7 = worksheet["F7"];

// Create a complex range using the Range.Union method.
Range complexRange1 = worksheet["A7:A9"].Union(rangeD5E7);

// Create a complex range using the IRangeProvider.Union method.
Range complexRange2 = worksheet.Range.Union(new Range[] { rangeRow11, rangeA1D4, rangeF7 });

// Fill the ranges with different colors.
complexRange1.FillColor = myColor1;
complexRange2.FillColor = myColor2;

// Use the Areas property to get access to a component of a complex range.
complexRange2.Areas[2].FillColor = Color.Beige;
See Also