Aracılığıyla paylaş


SmartTagCollection.Add Yöntem

Akıllı etiket sonuna ekler SmartTagCollection.Bu tür veya üyenin yalnızca 2007 Microsoft Office sistemi projelerinde kullanılması amaçlanmaktadır. Akıllı etiketler Office 2010'da kullanılmamaktadır.
.

Ad alanı:  Microsoft.Office.Tools
Derleme:  Microsoft.Office.Tools.Common (Microsoft.Office.Tools.Common.dll içinde)

Sözdizimi

'Bildirim
Function Add ( _
    value As SmartTagBase _
) As Integer
int Add(
    SmartTagBase value
)

Parametreler

Dönüş Değeri

Tür: System.Int32
Yeni akıllı etiketin dizini SmartTagCollection.

Örnekler

Aşağıdaki kod Add yöntemi eklemek için bir Microsoft.Office.Tools.Excel.SmartTag topluluğu tarafından gösterilen akıllı etiketler için Workbook.VstoSmartTags özelliği.Bu kod örneği için sağlanan daha büyük bir örneğin parçasıdır Microsoft.Office.Tools.Excel.Action.

Belge düzeyi özelleştirmesi için örnektir.

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 Güvenliği

Ayrıca bkz.

Başvuru

SmartTagCollection Arabirim

Microsoft.Office.Tools Ad Alanı