Condividi tramite


Proprietà SmartTagBase.Expressions

Ottiene la raccolta di espressioni regolari che verranno riconosciute dallo smart tag. Questo tipo o membro deve essere utilizzato solo nei progetti per Microsoft Office System 2007. Gli smart tag sono deprecati in Office 2010.
.

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

Sintassi

'Dichiarazione
ReadOnly Property Expressions As RegexCollection
RegexCollection Expressions { get; }

Valore proprietà

Tipo: Microsoft.Office.Tools.RegexCollection
Ottiene un oggetto RegexCollection contenente le espressioni regolari che verranno riconosciute dallo smart tag.

Note

Utilizzare il metodo Add per aggiungere un'espressione regolare al set di espressioni regolari che verranno riconosciute 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à Expressions per aggiungere l'espressione regolare "[I|i]ssue\s\d{5,6}" alla raccolta di espressioni regolari riconosciute dallo smart tag. Questo esempio di codice fa parte di un esempio più esaustivo fornito per Microsoft.Office.Tools.Excel.Action.

WithEvents displayAddress As Microsoft.Office.Tools.Excel.Action

Private Sub AddSmartTag()

    Dim smartTagDemo As Microsoft.Office.Tools.Excel.SmartTag = _
        Globals.Factory.CreateSmartTag(
        "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}"))

    displayAddress = Globals.Factory.CreateAction("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 =
        Globals.Factory.CreateSmartTag(
            "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}"));

    displayAddress = Globals.Factory.CreateAction("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);
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

SmartTagBase Interfaccia

Spazio dei nomi Microsoft.Office.Tools