Export (0) Print
Expand All
Expand Minimize

WorksheetBase.SmartTags Property

Gets a Microsoft.Office.Interop.Excel.SmartTags object representing the collection of smart tags for the worksheet.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

public SmartTags SmartTags { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.SmartTags
A Microsoft.Office.Interop.Excel.SmartTags object representing the collection of smart tags for the worksheet.

The following code example adds a smart tag to a NamedRange control and then uses the SmartTags property to display the number of smart tags on the current worksheet.

This example is for a document-level customization.

private void DisplaySmartTags()
{
    Microsoft.Office.Tools.Excel.NamedRange NamedRange1 =
        this.Controls.AddNamedRange(this.Range["A1"],
        "NamedRange1");

    Globals.ThisWorkbook.SmartTagOptions.EmbedSmartTags = true;
    Globals.ThisWorkbook.Application.SmartTagRecognizers.Recognize = true;

    NamedRange1.Formula = "MSFT";
    Excel.SmartTag SmartTag1 =
        NamedRange1.SmartTags.Add(
        "urn:schemas-microsoft-com:smarttags#StockTickerSymbol");

    MessageBox.Show("There are " + this.SmartTags.Count.ToString() +
        " smart tags in this document.");
}

Show:
© 2015 Microsoft