SmartTagBase.Terms, propriété (System 2007)
Mise à jour : novembre 2007
Obtient la collection des littéraux de chaîne que la balise active reconnaîtra.
Espace de noms : Microsoft.Office.Tools
Assembly : Microsoft.Office.Tools.Common.v9.0 (dans Microsoft.Office.Tools.Common.v9.0.dll)
Syntaxe
Public ReadOnly Property Terms As StringCollection
Dim instance As SmartTagBase
Dim value As StringCollection
value = instance.Terms
public StringCollection Terms { get; }
Valeur de propriété
Type : System.Collections.Specialized.StringCollection
Obtient un StringCollection qui contient les littéraux de chaîne que la balise active reconnaîtra.
Notes
Utilisez la méthode Add pour ajouter un littéral de chaîne à l'ensemble des termes que la balise active reconnaîtra.
Exemples
L'exemple de code suivant crée un Microsoft.Office.Tools.Excel.SmartTag, puis utilise la propriété Terms pour ajouter le mot anglais "sale" à la collection des termes que la balise active reconnaît. Cet exemple de code fait partie d'un exemple plus développé fourni pour la classe Microsoft.Office.Tools.Excel.Action.
Cet exemple illustre une personnalisation au niveau du document.
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);
}
Autorisations
- Confiance totale accordée à l'appelant immédiat. Ce membre ne peut pas être utilisé par du code d'un niveau de confiance partiel. Pour plus d'informations, consultez Utilisation de bibliothèques à partir de code d'un niveau de confiance partiel.