SmartTagBase.Expressions 속성 (2007 시스템)

업데이트: 2007년 11월

스마트 태그가 인식할 정규식의 컬렉션을 가져옵니다.

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

구문

Public ReadOnly Property Expressions As RegexCollection

Dim instance As SmartTagBase
Dim value As RegexCollection

value = instance.Expressions
public RegexCollection Expressions { get; }

속성 값

형식: Microsoft.Office.Tools.RegexCollection

스마트 태그가 인식할 정규식이 들어 있는 RegexCollection을 가져옵니다.

설명

Add 메서드를 사용하여 스마트 태그가 인식할 정규식 집합에 정규식을 추가할 수 있습니다.

예제

다음 코드 예제에서는 Microsoft.Office.Tools.Excel.SmartTag를 만든 다음 Expressions 속성을 사용하여 스마트 태그가 인식할 정규식 컬렉션에 "[I|i]ssue\s\d{5,6}"이라는 정규식을 추가합니다. 이 코드 예제는 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);
}

권한

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

SmartTagBase 클래스

SmartTagBase 멤버

Microsoft.Office.Tools 네임스페이스