SmartTagCollection 클래스(2007 시스템)

업데이트: 2007년 11월

Visual Studio Tools for Office 솔루션에 있는 스마트 태그의 컬렉션을 나타냅니다.

네임스페이스:  Microsoft.Office.Tools
어셈블리:  Microsoft.Office.Tools.Common.v9.0(Microsoft.Office.Tools.Common.v9.0.dll)

구문

<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

설명

Visual Studio Tools for Office 솔루션에 스마트 태그를 만드는 경우 SmartTagBase 개체를 Workbook.VstoSmartTags 또는 Document.VstoSmartTags 속성에 추가합니다. 이러한 속성은 SmartTagCollection 형식입니다.

Visual Studio Tools for Office 솔루션의 스마트 태그에 대한 자세한 내용은 스마트 태그 개요를 참조하십시오.

예제

다음 코드에서는 Add 메서드를 사용하여 Workbook.VstoSmartTags 속성에 의해 노출되는 스마트 태그 컬렉션에 Microsoft.Office.Tools.Excel.SmartTag를 추가합니다. 이 코드 예제는 Microsoft.Office.Tools.Excel.Action 클래스에 대해 제공되는 보다 큰 예제의 일부입니다.

이 예제는 문서 수준 사용자 지정을 위한 것입니다.

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

상속 계층 구조

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

스레드로부터의 안전성

이 형식의 모든 공용 static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

참고 항목

참조

SmartTagCollection 멤버

Microsoft.Office.Tools 네임스페이스

기타 리소스

스마트 태그 개요