SmartTagCollection.Add (Método)

Agrega una etiqueta inteligente al final de la SmartTagCollection.Este tipo o miembro está diseñado para usarse exclusivamente en proyectos de 2007 Microsoft Office system. Las etiquetas inteligentes están desusadas en Office 2010.
.

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

Sintaxis

'Declaración
Function Add ( _
    value As SmartTagBase _
) As Integer
int Add(
    SmartTagBase value
)

Parámetros

Valor devuelto

Tipo: System.Int32
Índice de la nueva etiqueta inteligente de SmartTagCollection.

Ejemplos

El código siguiente utiliza el método Add para agregar Microsoft.Office.Tools.Excel.SmartTag a la colección de etiquetas inteligentes expuestas por la propiedad Workbook.VstoSmartTags.Este ejemplo de código forma parte de un ejemplo más extenso proporcionado para 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 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);
}

Seguridad de .NET Framework

Vea también

Referencia

SmartTagCollection Interfaz

Microsoft.Office.Tools (Espacio de nombres)