Workbook.VstoSmartTags Property (2007 System)
Gets the Microsoft.Office.Tools.SmartTagCollection associated with the workbook.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
Syntax
'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property VstoSmartTags As SmartTagCollection
'Usage
Dim instance As Workbook
Dim value As SmartTagCollection
value = instance.VstoSmartTags
[BrowsableAttribute(false)]
public SmartTagCollection VstoSmartTags { get; }
[BrowsableAttribute(false)]
public:
property SmartTagCollection^ VstoSmartTags {
SmartTagCollection^ get ();
}
public function get VstoSmartTags () : SmartTagCollection
Property Value
Type: Microsoft.Office.Tools.SmartTagCollection
The Microsoft.Office.Tools.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 version is for a document-level customization.
WithEvents ColorText As Microsoft.Office.Tools.Excel.Action
Private Sub AddSmartTag()
Dim ColorTag As New _
Microsoft.Office.Tools.Excel.SmartTag( _
"www.contoso.com/Demo#DemoSmartTag", "Demo Smart Tag")
Dim ColorText As New _
Microsoft.Office.Tools.Excel.Action("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
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);
}
private void colorText_Click(object sender,
Microsoft.Office.Tools.Excel.ActionEventArgs e)
{
e.Range.Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Blue);
}
This version is for an application-level add-in.
WithEvents ColorText As Microsoft.Office.Tools.Excel.Action
Private Sub AddSmartTag()
Dim vstoWorkbook As Workbook = Me.Application.ActiveWorkbook.GetVstoObject()
Dim ColorTag As New _
Microsoft.Office.Tools.Excel.SmartTag( _
"www.contoso.com/Demo#DemoSmartTag", "Demo Smart Tag")
Dim ColorText As New _
Microsoft.Office.Tools.Excel.Action("Color text blue")
AddHandler ColorText.Click, AddressOf ColorText_Click
ColorTag.Actions = _
New Microsoft.Office.Tools.Excel.Action() {ColorText}
ColorTag.Terms.Add("blue")
vstoWorkbook.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
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);
Workbook vstoWorkbook = this.Application.ActiveWorkbook.GetVstoObject();
colorTag.Actions =
new Microsoft.Office.Tools.Excel.Action[] {
colorText };
colorTag.Terms.Add("blue");
vstoWorkbook.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);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.Office.Tools.Excel Namespace
Other Resources
Change History
Date |
History |
Reason |
---|---|---|
July 2008 |
Added a version of the code example for an application-level add-in. |
SP1 feature change. |