Share via


SmartTagBase.Actions-Eigenschaft (2007 System)

Aktualisiert: November 2007

Ruft ein Array von Aktionen ab, die vom Smarttag verfügbar gemacht werden, oder legt ein solches Array fest.

Namespace:  Microsoft.Office.Tools
Assembly:  Microsoft.Office.Tools.Common.v9.0 (in Microsoft.Office.Tools.Common.v9.0.dll)

Syntax

Public Property Actions As ActionBase()

Dim instance As SmartTagBase
Dim value As ActionBase()

value = instance.Actions

instance.Actions = value
public ActionBase[] Actions { get; set; }

Eigenschaftenwert

Typ: array<Microsoft.Office.Tools.ActionBase[]

Ein Array von Aktionen, die vom Smarttag verfügbar gemacht werden.

Ausnahmen

Ausnahme Bedingung
InvalidOperationException

Diese Eigenschaft wird festgelegt, nachdem das Smarttag einer SmartTagCollection hinzugefügt wurde.

Hinweise

Die Größe eines Arrays muss festgelegt sein, da ein dynamisches Hinzufügen von Aktionen zum Smarttag dazu führen würde, dass alle Smarttags im Dokument erneut geladen werden.

Beispiele

Im folgenden Codebeispiel wird ein Microsoft.Office.Tools.Excel.SmartTag erstellt, und dann wird der Actions-Eigenschaft eine Aktion hinzugefügt. Dieses Codebeispiel ist Teil eines umfangreicheren Beispiels, das für die Microsoft.Office.Tools.Excel.Action-Klasse bereitgestellt wird.

Dieses Beispiel bezieht sich auf eine Anpassung auf Dokumentebene.

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);
}

Berechtigungen

Siehe auch

Referenz

SmartTagBase-Klasse

SmartTagBase-Member

Microsoft.Office.Tools-Namespace