次の方法で共有


SmartTagBase.Actions プロパティ

スマート タグによって公開されるアクションの配列を取得または設定します。 この型またはメンバーは 2007 Microsoft Office システムのプロジェクト専用です。スマート タグは Office 2010 では使用されていません。
.

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

構文

'宣言
Property Actions As ActionBase()
ActionBase[] Actions { get; set; }

プロパティ値

型 : array<Microsoft.Office.Tools.ActionBase[]
スマート タグによって公開されるアクションの配列です。

例外

例外 条件
InvalidOperationException

このプロパティは、スマート タグを SmartTagCollection に追加した後に設定します。

解説

アクションを動的にスマート タグに追加すると、ドキュメント内のすべてのスマート タグが再読み込みされることになるので、事前に配列のサイズを決定しておく必要があります。

Microsoft.Office.Tools.Excel.SmartTag を作成し、Actions プロパティにアクションを追加するコード例を次に示します。 このコード例は、Microsoft.Office.Tools.Excel.Action のトピックで取り上げているコード例の一部分です。

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

Private Sub AddSmartTag()

    Dim smartTagDemo As Microsoft.Office.Tools.Excel.SmartTag = _
        Globals.Factory.CreateSmartTag(
        "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}"))

    displayAddress = Globals.Factory.CreateAction("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 =
        Globals.Factory.CreateSmartTag(
            "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}"));

    displayAddress = Globals.Factory.CreateAction("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);
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

SmartTagBase インターフェイス

Microsoft.Office.Tools 名前空間