Compartilhar via


SmartTagCollection Classe (sistema de 2007)

Representa uma coleção de SMART Rótulos em um Visual Studio Tools for Office solução.

Namespace:  Microsoft.Office.Tools
Assembly:  Microsoft.Office.Tools.Common.v9.0 (em Microsoft.Office.Tools.Common.v9.0.dll)

Sintaxe

<PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
Public Class SmartTagCollection _
    Inherits CollectionBase _
    Implements ISupportInitialize, IDisposable

Dim instance As SmartTagCollection
[PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")]
public class SmartTagCollection : CollectionBase, 
    ISupportInitialize, IDisposable

Comentários

Quando você cria um marca SMART um Visual Studio Tools for Office solução, adicionar um SmartTagBase objeto para o Workbook.VstoSmartTags ou Document.VstoSmartTags Propriedades. Essas propriedades têm o tipo de SmartTagCollection.

Para obter mais informações sobre Rótulos inteligentes a Visual Studio Tools for Office soluções, consulte Visão geral sobre marcas inteligentes.

Exemplos

O código a seguir usa o Add Para adicionar um Microsoft.Office.Tools.Excel.SmartTag a coleção de SMART Rótulos expostos pela Workbook.VstoSmartTags propriedade. Este exemplo de código é parte de um exemplo maior fornecido para a classe Microsoft.Office.Tools.Excel.Action.

Este exemplo é para uma personalização em nível de documento.

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

PrivateSub AddSmartTag()
    Dim smartTagDemo AsNew  _
        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)
EndSub
private Microsoft.Office.Tools.Excel.Action displayAddress;

privatevoid 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);
}

Hierarquia de herança

System.Object
  System.Collections.CollectionBase
    Microsoft.Office.Tools.SmartTagCollection

Acesso thread-safe

Quaisquer membros static (Shared no Visual Basic) públicos deste tipo são thread-safe. Não há garantia de que qualquer membro de instância seja thread-safe.

Consulte também

Referência

Membros SmartTagCollection

Namespace Microsoft.Office.Tools

Outros recursos

Visão geral sobre marcas inteligentes