- Document Solutions for Excel, .NET Edition Overview
- Key Features
- Getting Started
-
Features
-
Worksheet
- Work with Worksheets
-
Range Operations
- Access a Range
- Get Intersection, Union and Offset Range
- Access Areas in a Range
- Get Range and Range Area
- Get Special Cell Ranges
- Access Cells, Rows and Columns in a Range
- Get Address of Cell Range
- Cut or Copy Cell Ranges
- Cut or Copy Shape, Slicer, Chart and Picture
- Paste or Ignore Data in Hidden Range
- Find and Replace Data
- Get Row and Column Count
- Hide Rows and Columns
- Insert And Delete Cell Ranges
- Insert and Delete Rows and Columns
- Merge Cells
- Auto Merge Cells
- Protect Cell Range
- Set Values to a Range
- Set Custom Objects to a Range
- Set Row Height and Column Width
- Auto Fit Row Height and Column Width
- Work with Used Range
- Measure Digital Width
- Set Default Values for Cell Range
- Set Cell Background Image for Cell Range
- Ignore Errors in Cell Range
- Customize Worksheets
- Worksheet Views
- Cell Types
- Quote Prefix
- Tags
- Rich Text
- Background Image
- Workbook
- Comments
- Hyperlinks
- Sort
- Filter
- Group
- Conditional Formatting
- Data Validations
- Data Binding
- Import Data
- Digital Signatures
- Formulas
- Custom Functions
- Shapes
- Document Properties
- Styles
- Form Controls
- Barcodes
- Themes and Colors
- Chart
- Table
- Pivot Table
- Pivot Chart
- Sparkline
- Slicer
- Logging
- Defined Names
-
Worksheet
- Templates
- File Operations
- Document Solutions Data Viewer
- API Reference
- Release Notes
(Showing Draft Content)
Access Cells, Rows and Columns in a Range
You can access cells, rows and columns in a range by using the Cells property, Rows property and Columns property of the IRange interface.
Refer to the following example code in order to access cells, rows and columns in a worksheet.
var range = worksheet.Range["A5:B7"];
//Set value for cell A7.
range.Cells[4].Value = "A7";
//Cell is B6
range.Cells[1, 1].Value = "B6";
//Row count is 3 and range is A6:B6.
var rowCount = range.Rows.Count;
var row = range.Rows[1].ToString();
//Set interior color for row range A6:B6.
range.Rows[1].Interior.Color = Color.LightBlue;
//Column count is 2 and range is B5:B7.
var columnCount = range.Columns.Count;
var column = range.Columns[1].ToString();
//Set values for column range B5:B7.
range.Columns[1].Interior.Color = Color.LightSkyBlue;
//Entire rows are from row 5 to row 7
var entirerow = range.EntireRow.ToString();
//Entire columns are from column A to column B
var entireColumn = range.EntireColumn.ToString();