WorkbookBase.VstoSmartTags Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the SmartTagCollection associated with the workbook. This type or member is intended to be used only in projects for the 2007 Microsoft Office system. Smart tags are deprecated in Office 2010..
public:
property Microsoft::Office::Tools::SmartTagCollection ^ VstoSmartTags { Microsoft::Office::Tools::SmartTagCollection ^ get(); };
public Microsoft.Office.Tools.SmartTagCollection VstoSmartTags { get; }
member this.VstoSmartTags : Microsoft.Office.Tools.SmartTagCollection
Public ReadOnly Property VstoSmartTags As SmartTagCollection
Property Value
The SmartTagCollection associated with the workbook.
Examples
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.
This example is for a document-level customization.
private void AddSmartTag()
{
Microsoft.Office.Tools.Excel.SmartTag colorTag =
Globals.Factory.CreateSmartTag(
"www.contoso.com/Demo#DemoSmartTag", "Demo Smart Tag");
Microsoft.Office.Tools.Excel.Action colorText =
Globals.Factory.CreateAction("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);
}
private void colorText_Click(object sender,
Microsoft.Office.Tools.Excel.ActionEventArgs e)
{
e.Range.Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Blue);
}
WithEvents ColorText As Microsoft.Office.Tools.Excel.Action
Private Sub AddSmartTag()
Dim ColorTag As Microsoft.Office.Tools.Excel.SmartTag = _
Globals.Factory.CreateSmartTag( _
"www.contoso.com/Demo#DemoSmartTag", "Demo Smart Tag")
Dim ColorText As Microsoft.Office.Tools.Excel.Action = _
Globals.Factory.CreateAction("Color text blue")
AddHandler ColorText.Click, AddressOf ColorText_Click
ColorTag.Actions = _
New Microsoft.Office.Tools.Excel.Action() {ColorText}
ColorTag.Terms.Add("blue")
Me.VstoSmartTags.Add(ColorTag)
End Sub
Private Sub ColorText_Click(ByVal sender As Object, _
ByVal e As Microsoft.Office.Tools.Excel.ActionEventArgs)
e.Range.Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Blue)
End Sub