Share via


SmartTagCollection 인터페이스

Visual Studio의 Office 개발 도구를 사용하여 만든 Word 또는 Excel 솔루션의 스마트 태그 컬렉션을 나타냅니다.

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

구문

‘선언
<GuidAttribute("30a90086-8c89-4e19-8299-47765d808408")> _
Public Interface SmartTagCollection _
    Inherits IEnumerable, IDisposable
[GuidAttribute("30a90086-8c89-4e19-8299-47765d808408")]
public interface SmartTagCollection : IEnumerable, 
    IDisposable

SmartTagCollection 형식에서는 다음과 같은 멤버를 노출합니다.

속성

  이름 설명
Public 속성 Item 지정된 인덱스에 있는 스마트 태그를 가져옵니다.

위쪽

메서드

  이름 설명
Public 메서드 Add SmartTagCollection 의 끝에 스마트 태그를 추가합니다.
Public 메서드 AddRange SmartTagCollection 의 끝에 스마트 태그의 배열을 추가합니다.
Public 메서드 BeginInit 인프라입니다.
Public 메서드 Contains SmartTagCollection 에 특정 스마트 태그가 포함되어 있는지 확인합니다.
Public 메서드 CopyTo SmartTagCollection 에 있는 스마트 태그를 스마트 태그의 1차원 배열(지정된 인덱스에서 시작)에 복사합니다.
Public 메서드 Dispose 관리되지 않는 리소스의 확보, 해제 또는 다시 설정과 관련된 응용 프로그램 정의 작업을 수행합니다. (IDisposable에서 상속됨)
Public 메서드 EndInit 인프라입니다.
Public 메서드 GetEnumerator 컬렉션을 반복하는 열거자를 반환합니다. (IEnumerable에서 상속됨)
Public 메서드 IndexOf SmartTagCollection 에 지정된 스마트 태그의 인덱스를 확인합니다.
Public 메서드 Insert SmartTagCollection 의 지정된 인덱스에 스마트 태그를 삽입합니다.
Public 메서드 Remove SmartTagCollection 에서 스마트 태그를 제거합니다.

위쪽

설명

스마트 태그를 만들 때 SmartTagBase 개체를 Workbook.VstoSmartTags 또는 Document.VstoSmartTags 속성에 추가합니다. 이러한 속성은 SmartTagCollection 형식입니다.

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

참고

이 인터페이스는 Visual Studio Tools for Office Runtime에 의해 구현되며 코드에서 직접 구현할 수는 없습니다. 자세한 내용은 Visual Studio Tools for Office 런타임 개요를 참조하십시오.

용도

이 형식은 Excel 2007 및 Word 2007용 프로젝트에서만 사용할 수 있습니다. 스마트 태그는 Excel 2010 및 Word 2010에서 더 이상 사용되지 않습니다. 자세한 내용은 스마트 태그 개요을 참조하십시오.

이 문서에서는 .NET Framework 4를 대상으로 하는 Office 프로젝트에서 사용되는 이 형식의 버전을 설명합니다. .NET Framework 3.5를 대상으로 하는 프로젝트에서는 이 형식의 멤버가 다를 수 있으며 이 형식을 위해 제공되는 코드 예제가 작동하지 않을 수도 있습니다. .NET Framework 3.5를 대상으로 하는 프로젝트의 이 형식에 대한 문서는 Visual Studio 2008 설명서의 다음 참조 섹션을 참조하십시오. https://go.microsoft.com/fwlink/?LinkId=160658.

예제

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

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

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

Private Sub AddSmartTag()

    ' Create the smart tag for .NET Framework 4 projects.
    Dim smartTagDemo As Microsoft.Office.Tools.Excel.SmartTag = _
        Globals.Factory.CreateSmartTag(
        "www.microsoft.com/Demo#DemoSmartTag",
        "Demonstration Smart Tag")

    ' For .NET Framework 3.5 projects, use the following code to create the smart tag.
    ' 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 for .NET Framework 4 projects.
    displayAddress = Globals.Factory.CreateAction("To be replaced")

    ' For .NET Framework 3.5 projects, use the following code to 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()
{
    // Create the smart tag for .NET Framework 4 projects.
    Microsoft.Office.Tools.Excel.SmartTag smartTagDemo =
        Globals.Factory.CreateSmartTag(
            "www.microsoft.com/Demo#DemoSmartTag",
            "Demonstration Smart Tag");

    // For .NET Framework 3.5 projects, use the following code to create the smart tag.
    // 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 for .NET Framework 4 projects.
    displayAddress = Globals.Factory.CreateAction("To be replaced");

    // For .NET Framework 3.5 projects, use the following code to 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);
}

참고 항목

참조

Microsoft.Office.Tools 네임스페이스

기타 리소스

스마트 태그 개요