Microsoft Office Tutorials and References
In Depth Information
Adding and executing the preceding code results in the following screenshot:
In any spreadsheet program, such as Microsoft Office Excel, each rectangular box
is referred to as a cell. A cell is the intersection point of a column and a row inside
the spreadsheet. Using VSTO, you can manipulate the cells in the worksheet for
processing data in the worksheet. You can apply formulas, add smart tags, and
merge and format cells, depending on conditions.
In the following example, you will see how to merge a cell in the worksheet by using
the Range object, and also how to use the copy operation by using the Range object in
the Excel object model.
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)
// Merging the cell of provided range using cell ranges
// Copy the range of cells and put in another range of cell