Classe SmartTagCollection (System 2007)
Aggiornamento: novembre 2007
Rappresenta un insieme di smart tag in una soluzione Visual Studio Tools per Office.
Spazio dei nomi: Microsoft.Office.Tools
Assembly: Microsoft.Office.Tools.Common.v9.0 (in Microsoft.Office.Tools.Common.v9.0.dll)
Sintassi
<PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
Public Class SmartTagCollection _
Inherits CollectionBase _
Implements ISupportInitialize, IDisposable
Dim instance As SmartTagCollection
[PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")]
public class SmartTagCollection : CollectionBase,
ISupportInitialize, IDisposable
Note
Quando si crea uno smart tag in una soluzione Visual Studio Tools per Office, viene aggiunto un oggetto SmartTagBase alle proprietà Workbook.VstoSmartTags o Document.VstoSmartTags. Il tipo di tali proprietà è SmartTagCollection.
Per ulteriori informazioni sugli smart tag nelle soluzioni Visual Studio Tools per Office, vedere Cenni preliminari sugli smart tag.
Esempi
Nell'esempio di codice riportato di seguito viene utilizzato il metodo Add per aggiungere un oggetto Microsoft.Office.Tools.Excel.SmartTag all'insieme di smart tag esposto dalla proprietà Workbook.VstoSmartTags. L'esempio di codice fa parte di un esempio più esaustivo fornito per la classe Microsoft.Office.Tools.Excel.Action.
Questo esempio è valido per una personalizzazione a livello di documento.
WithEvents displayAddress As Microsoft.Office.Tools.Excel.Action
Private Sub AddSmartTag()
Dim smartTagDemo As New _
Microsoft.Office.Tools.Excel.SmartTag( _
"www.microsoft.com/Demo#DemoSmartTag", _
"Demonstration Smart Tag")
' Specify a term and an expression to recognize.
smartTagDemo.Terms.Add("sale")
smartTagDemo.Expressions.Add( _
New System.Text.RegularExpressions.Regex( _
"[I|i]ssue\s\d{5,6}"))
' Create the action.
displayAddress = New Microsoft.Office.Tools.Excel.Action( _
"To be replaced")
' Add the action to the smart tag.
smartTagDemo.Actions = New Microsoft.Office.Tools.Excel.Action() { _
displayAddress}
' Add the smart tag.
Me.VstoSmartTags.Add(smartTagDemo)
End Sub
private Microsoft.Office.Tools.Excel.Action displayAddress;
private void AddSmartTag()
{
Microsoft.Office.Tools.Excel.SmartTag smartTagDemo =
new Microsoft.Office.Tools.Excel.SmartTag(
"www.microsoft.com/Demo#DemoSmartTag",
"Demonstration Smart Tag");
// Specify a term and an expression to recognize.
smartTagDemo.Terms.Add("sale");
smartTagDemo.Expressions.Add(
new System.Text.RegularExpressions.Regex(
@"[I|i]ssue\s\d{5,6}"));
// Create the action.
displayAddress = new Microsoft.Office.Tools.Excel.Action(
"To be replaced");
// Add the action to the smart tag.
smartTagDemo.Actions = new Microsoft.Office.Tools.Excel.Action[] {
displayAddress };
// Add the smart tag.
this.VstoSmartTags.Add(smartTagDemo);
displayAddress.BeforeCaptionShow += new
Microsoft.Office.Tools.Excel.BeforeCaptionShowEventHandler(
DisplayAddress_BeforeCaptionShow);
displayAddress.Click += new
Microsoft.Office.Tools.Excel.ActionClickEventHandler(
DisplayAddress_Click);
}
Gerarchia di ereditarietà
System.Object
System.Collections.CollectionBase
Microsoft.Office.Tools.SmartTagCollection
Codice thread safe
Qualsiasi membro static (Shared in Visual Basic) pubblico di questo tipo è thread-safe. I membri di istanza non sono garantiti come thread-safe.
Vedere anche
Riferimenti
Spazio dei nomi Microsoft.Office.Tools