Range or a range area refers to an array of cells that have been defined in a spreadsheet. While working with worksheets in a workbook, users can define multiple ranges and then further access those range areas separately to perform certain tasks like formatting of cells, merging of cells, insertion or deletion of cells within a range and other useful operations.
Refer to the following example code to see how you can define a range.
C# |
Copy Code |
---|---|
// Defining range var range = worksheet.Range["A5:B7,C3,H5:N6"]; |
Refer to the following example code to see how you can access the range area with a range.
C# |
Copy Code |
---|---|
//area1 is A5:B7. var area1 = range.Areas[0]; area1.Value = "5"; //area2 is C3. var area2 = range.Areas[1]; area2.Value = "8"; //area3 is H5:N6. var area3 = range.Areas[2]; area3.Value = "10"; |