Share via


SmartTagBase.Actions, propriété (System 2007)

Mise à jour : novembre 2007

Obtient ou définit un tableau d'actions qui sont exposées par la balise active.

Espace de noms :  Microsoft.Office.Tools
Assembly :  Microsoft.Office.Tools.Common.v9.0 (dans Microsoft.Office.Tools.Common.v9.0.dll)

Syntaxe

Public Property Actions As ActionBase()

Dim instance As SmartTagBase
Dim value As ActionBase()

value = instance.Actions

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

Valeur de propriété

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

Tableau d'actions qui sont exposées par la balise active.

Exceptions

Exception Condition
InvalidOperationException

Cette propriété est définie après que la balise active a été ajoutée à une SmartTagCollection.

Notes

La taille du tableau doit être prédéterminée, car l'ajout dynamique d'actions à la balise active entraînerait un rechargement de toutes les balises actives dans le document.

Exemples

L'exemple de code suivant crée un Microsoft.Office.Tools.Excel.SmartTag, puis ajoute une action à la propriété Actions. 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

Voir aussi

Référence

SmartTagBase, classe

Membres SmartTagBase

Microsoft.Office.Tools, espace de noms