Condividi tramite


Proprietà SmartTagBase.Actions (System 2007)

Aggiornamento: novembre 2007

Ottiene o imposta una matrice di azioni esposte 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 Property Actions As ActionBase()

Dim instance As SmartTagBase
Dim value As ActionBase()

value = instance.Actions

instance.Actions = value
public ActionBase[] Actions { get; set; }

Valore proprietà

Tipo: array<Microsoft.Office.Tools.ActionBase[]

Matrice di azioni esposte dallo smart tag.

Eccezioni

Eccezione Condizione
InvalidOperationException

La proprietà viene impostata dopo l'aggiunta dello smart tag a SmartTagCollection.

Note

Le dimensioni della matrice devono essere predeterminate. Se le azioni vengono aggiunte dinamicamente allo smart tag, verranno ricaricati tutti gli smart tag del documento.

Esempi

Nell'esempio di codice riportato di seguito viene creato un oggetto Microsoft.Office.Tools.Excel.SmartTag. Viene quindi aggiunta un'azione alla proprietà Actions. 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);
}

Autorizzazioni

Vedere anche

Riferimenti

SmartTagBase Classe

Membri SmartTagBase

Spazio dei nomi Microsoft.Office.Tools