次の方法で共有


SmartTagBase.Terms プロパティ (2007 System)

更新 : 2007 年 11 月

スマート タグで認識するリテラル文字列のコレクションを取得します。

名前空間 :  Microsoft.Office.Tools
アセンブリ :  Microsoft.Office.Tools.Common.v9.0 (Microsoft.Office.Tools.Common.v9.0.dll 内)

構文

'宣言
Public ReadOnly Property Terms As StringCollection
'使用
Dim instance As SmartTagBase
Dim value As StringCollection

value = instance.Terms
public StringCollection Terms { get; }

プロパティ値

型 : System.Collections.Specialized.StringCollection

スマート タグで認識するリテラル文字列が含まれる StringCollection を取得します。

解説

スマート タグで認識する項目の集合にリテラル文字列を追加するには、Add メソッドを使用します。

Microsoft.Office.Tools.Excel.SmartTag を作成し、Terms プロパティを使用して、スマート タグで認識する項目のコレクションに「sale」という語を追加するコード例を次に示します。次のコード例は、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 名前空間