Compartir a través de


SmartTagBase.Actions (Propiedad) (2007 System)

Actualización: noviembre 2007

Obtiene o establece una matriz de acciones que expone la etiqueta inteligente.

Espacio de nombres:  Microsoft.Office.Tools
Ensamblado:  Microsoft.Office.Tools.Common.v9.0 (en Microsoft.Office.Tools.Common.v9.0.dll)

Sintaxis

Public Property Actions As ActionBase()

Dim instance As SmartTagBase
Dim value As ActionBase()

value = instance.Actions

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

Valor de propiedad

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

Matriz de acciones que expone la etiqueta inteligente.

Excepciones

Excepción Condición
InvalidOperationException

Esta propiedad se establece después de agregar la etiqueta inteligente a la colección SmartTagCollection.

Comentarios

El tamaño de la matriz se debe predeterminar, ya que las acciones dinámicas de adición a la etiqueta inteligente harán que se vuelvan a cargar todas las etiquetas inteligentes del documento.

Ejemplos

En el ejemplo de código siguiente se crea Microsoft.Office.Tools.Excel.SmartTag y, a continuación, se agrega una acción a la propiedad Actions. Este ejemplo de código forma parte de un ejemplo más extenso referente a la clase Microsoft.Office.Tools.Excel.Action.

Se trata de un ejemplo para una personalización en el nivel del 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);
}

Permisos

Vea también

Referencia

SmartTagBase (Clase)

SmartTagBase (Miembros)

Microsoft.Office.Tools (Espacio de nombres)