[フレーム]
 []
 
MESCIUS Logo MESCIUS Logo
Document Solutions for Excel, .NET Edition Logo
DEMOS DOCS API PRICING
FREE TRIAL
(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();

AltStyle によって変換されたページ (->オリジナル) /