Microsoft Office Excel is loaded with a wide variety of objects that can be programmed for using VSTO 3.0. The Range
object is probably the most frequently-used object in the Excel object model, and helps an Excel developer to manipulate the cells and their data by using a referenced range. In this section, we will see how to refer to cells programmatically, and manipulate the ranges of data in Microsoft Office Excel 2007. The Excel range is a vital part of the Excel application. A range may correspond to a logical relationship between cells.
The following sample program explains how to read the cells of a worksheet by using the Range
object, and how to format the background color of a range of cells.
Open Visual Studio 2008 and create a new solution, as before. Write the following code inside the Sheet1.cs
file.
private void Sheet1_Startup(object sender, System.EventArgs e) { // Reading Excel using Range object Excel.Range AuthorRange = Globals.Sheet1.Range["A1", "C5...