SmartTagCollection.Add(SmartTagBase) Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Sonuna akıllı etiket ekler SmartTagCollection . Bu tür veya üye, yalnızca 2007 Microsoft Office sistemine ait projelerde kullanılmaya yöneliktir. Akıllı etiketler Office 2010'da kullanım dışı bırakılmıştır..
public int Add (Microsoft.Office.Tools.SmartTagBase value);
Parametreler
- value
- SmartTagBase
Eklenecek akıllı etiket örneği.
Döndürülenler
İçindeki yeni akıllı etiketin dizini SmartTagCollection .
Örnekler
Aşağıdaki kod, Add Microsoft.Office.Tools.Excel.SmartTag özelliği tarafından kullanıma sunulan Akıllı Etiketler koleksiyonuna eklemek için yöntemini kullanır Microsoft.Office.Tools.Excel.Workbook.VstoSmartTags . Bu kod örneği, için sağlanmış daha büyük bir örneğin bir parçasıdır Microsoft.Office.Tools.Excel.Action .
Bu örnek, belge düzeyinde özelleştirme içindir
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);
}
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