SmartTagBase.Actions (Propiedad)
Obtiene o establece una matriz de acciones que expone la etiqueta inteligente.Este tipo o miembro está diseñado para usarse exclusivamente en proyectos de 2007 Microsoft Office system. Las etiquetas inteligentes están desusadas en Office 2010.
.
Espacio de nombres: Microsoft.Office.Tools
Ensamblado: Microsoft.Office.Tools.Common (en Microsoft.Office.Tools.Common.dll)
Sintaxis
'Declaración
Property Actions As ActionBase()
ActionBase[] Actions { get; set; }
Valor de propiedad
Tipo: array<Microsoft.Office.Tools.ActionBase[]
Matriz de acciones que expone la etiqueta inteligente.
Excepciones
Excepción | Condición |
---|---|
InvalidOperationException | Esta propiedad se establece después de agregar la etiqueta inteligente a la colección SmartTagCollection. |
Comentarios
El tamaño de la matriz se debe predeterminar, ya que las acciones dinámicas de adición a la etiqueta inteligente harán que se vuelvan a cargar todas las etiquetas inteligentes del documento.
Ejemplos
En el ejemplo de código siguiente se crea Microsoft.Office.Tools.Excel.SmartTag y, a continuación, se agrega una acción a la propiedad Actions.Este ejemplo de código forma parte de un ejemplo más extenso proporcionado para 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);
}
Seguridad de .NET Framework
- Plena confianza para el llamador inmediato. Un código de confianza parcial no puede utilizar este miembro. Para obtener más información, vea Utilizar bibliotecas de código que no es de plena confianza.