Condividi tramite


Proprietà SmartTagBase.Terms (System 2007)

Aggiornamento: novembre 2007

Ottiene l'insieme di stringhe letterali che verranno riconosciute dallo smart tag.

Spazio dei nomi:  Microsoft.Office.Tools
Assembly:  Microsoft.Office.Tools.Common.v9.0 (in Microsoft.Office.Tools.Common.v9.0.dll)

Sintassi

Public ReadOnly Property Terms As StringCollection

Dim instance As SmartTagBase
Dim value As StringCollection

value = instance.Terms
public StringCollection Terms { get; }

Valore proprietà

Tipo: System.Collections.Specialized.StringCollection

Ottiene un oggetto StringCollection contenente le stringhe letterali che verranno riconosciute dallo smart tag.

Note

Utilizzare il metodo Add per aggiungere una stringa letterale all'insieme di termini che verranno riconosciuti dallo smart tag.

Esempi

Nell'esempio di codice riportato di seguito viene creato un oggetto Microsoft.Office.Tools.Excel.SmartTag. Viene quindi utilizzata la proprietà Terms per aggiungere la parola "sale" all'insieme di termini riconosciuti dallo smart tag. Questo 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);
}

Autorizzazioni

Vedere anche

Riferimenti

SmartTagBase Classe

Membri SmartTagBase

Spazio dei nomi Microsoft.Office.Tools