Workbook.VstoSmartTags Property
Visual Studio 2005
Gets the Microsoft.Office.Tools.SmartTagCollection associated with the workbook.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)
The following code example creates a smart tag that sets the font color of a cell to blue when the term "blue" is recognized. The example adds the smart tag to the workbook by using the VstoSmartTags property.
private void AddSmartTag() { Microsoft.Office.Tools.Excel.SmartTag colorTag = new Microsoft.Office.Tools.Excel.SmartTag( "www.contoso.com/Demo#DemoSmartTag", "Demo Smart Tag"); Microsoft.Office.Tools.Excel.Action colorText = new Microsoft.Office.Tools.Excel.Action("Color text blue"); colorText.Click += new Microsoft.Office.Tools.Excel.ActionClickEventHandler( colorText_Click); colorTag.Actions = new Microsoft.Office.Tools.Excel.Action[] {colorText}; colorTag.Terms.Add("blue"); this.VstoSmartTags.Add(colorTag); } public void colorText_Click(object sender, Microsoft.Office.Tools.Excel.ActionEventArgs e) { e.Range.Font.Color = ColorTranslator.ToOle(Color.Blue); }