Microsoft Office Tutorials and References
In Depth Information
The XMLMappedRange control
DocEvents_BeforeDoubleClickEventHandler(
Sheet1_BeforeDoubleClick);
}
private void Sheet1_BeforeDoubleClick(Microsoft.Office.
Interop.Excel.Range AuthorRange, ref bool Proceed)
{
// Setting the value in the cell
Globals.Sheet1.Range["B2", missing].Value2 = "Buy VSTO Book";
// Formatting the color for the cell value
Globals.Sheet1.Range["B2", missing].Font.Color =
System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.
DarkGreen);
// Formatting the font style for the cell value
Globals.Sheet1.Range["B2", missing].Font.Bold = true;
}
The XMLMappedRange control
The XMLMappedRange control supports simple data binding such as binding to a
single data field. The Microsoft.Office.Tools.Excel.XMLMappedRange control
can use the same formatting that you apply to a Microsoft.Office.Interop.
Excel.Range .
event
The SelectionChange event is raised when the cell related to the attribute is
selected or deselected. To perform SelectionChange event registration in the Excel
worksheet host item, open Visual Studio 2008 and create a new solution, as before.
Write the following code in the Sheet1.cs file:
The SelectionChange event
SelectionChange event
event
private void InternalStartup()
{
this.SelectionChange += new Microsoft.Office.Interop.Excel.
DocEvents_SelectionChangeEventHandler(
Sheet1_SelectionChange);
}
private void Sheet1_SelectionChange(Excel.Range AuthorCellPoint)
{
// Reading the address of the cell selected
string AuthorCellSelection = AuthorCellPoint.
get_Address(missing,missing, Excel.XlReferenceStyle.xlA1,
missing, missing);
 
Search JabSto ::




Custom Search