SmartTagBase.Actions プロパティ (2007 System)
更新 : 2007 年 11 月
スマート タグによって公開されるアクションの配列を取得または設定します。
名前空間 : Microsoft.Office.Tools
アセンブリ : Microsoft.Office.Tools.Common.v9.0 (Microsoft.Office.Tools.Common.v9.0.dll 内)
構文
'宣言
Public Property Actions As ActionBase()
'使用
Dim instance As SmartTagBase
Dim value As ActionBase()
value = instance.Actions
instance.Actions = value
public 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 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);
}
アクセス許可
- 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。