.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

Workbook.Range Property

Provides access to the cell range in the workbook.

You need an active license for the DevExpress Office File API Subscription or DevExpress Universal Subscription to use this property in production code.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Docs.v21.2.dll


public IRangeProvider Range { get; }

Property Value

Type Description

An object implementing the IRangeProvider interface.


A cell range is a rectangular block of cells that is specified by the CellRange object. The Range property returns the IRangeProvider object whose members can be used to obtain a cell range.

  • IRangeProvider.Item, IRangeProvider.Parse - obtain a cell range by its cell reference or name.

    To access a cell range located in a specific worksheet of the workbook, specify this worksheet name before the cell reference, and separate them with an exclamation point (for example, workbook.Range.Parse(“Sheet2!C3:D9”)). If you do not specify the worksheet name explicitly, the cell range located on the currently active worksheet is returned.

  • IRangeProvider.FromLTRB - obtains a cell range by the indexes of its top left and bottom right cells.

    This method returns a cell range located in the worksheet that is currently active.

In addition, to get a cell range located in a specific worksheet, you can use the Worksheet.Range property of the corresponding worksheet object.


The table below describes how to access a cell range in a worksheet.


Use one of the following members

Access a cell range by its reference in the A1 style or name.






Access a cell range by its reference in the R1C1 style.



Access a cell range by row and column indexes.



Create a union cell range.




Access subranges of a union cell range.


using DevExpress.Spreadsheet;
// ...

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

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

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

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

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

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

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

// A minimal rectangular range that includes all listed cells: C6, D9 and E7.
CellRange 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.
CellRange 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.
CellRange rangeE9E10 = worksheet.Range["C5:E10 E9:G13"];

// Create a defined name for the D20:G23 cell range.
worksheet.DefinedNames.Add("Range_Name", "Sheet1!$D$20:$G$23");
// Access a range by its defined name.
CellRange rangeD20G23 = worksheet.Range["Range_Name"];

CellRange rangeA1D4 = worksheet["A1:D4"];
CellRange rangeD5E7 = worksheet["D5:E7"];
CellRange rangeRow11 = worksheet["11:11"];
CellRange rangeF7 = worksheet["F7"];

// Create a complex range via the Range.Union method.
CellRange complexRange1 = worksheet["B7:C9"].Union(rangeD5E7);

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

// Create a complex range from multiple cell ranges separated by commas.
CellRange complexRange3 = worksheet["D15:F18, G19:H20, I21"];

// Fill the ranges with different colors.
complexRange1.FillColor = Color.LightBlue;
complexRange2.FillColor = Color.LightGreen;
complexRange3.FillColor = Color.LightPink;

// Use the Areas property to get access to a complex range's component.
complexRange2.Areas[2].Borders.SetOutsideBorders(Color.DarkGreen, BorderLineStyle.Medium);


See Also