WorksheetBase.SmartTags 属性

获取一个 Microsoft.Office.Interop.Excel.SmartTags 对象,该对象表示工作表的智能标记的集合。

命名空间:  Microsoft.Office.Tools.Excel
程序集:  Microsoft.Office.Tools.Excel.v4.0.Utilities(在 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 中)

语法

声明
Public ReadOnly Property SmartTags As SmartTags
    Get
public SmartTags SmartTags { get; }

属性值

类型:Microsoft.Office.Interop.Excel.SmartTags
一个 Microsoft.Office.Interop.Excel.SmartTags 对象,表示工作表的智能标记的集合。

示例

下面的代码示例向 NamedRange 控件添加一个智能标记,然后使用 SmartTags 属性显示当前工作表上的智能标记的数目。

此示例针对的是文档级自定义项。

Private Sub DisplaySmartTags()
    Dim NamedRange1 As Microsoft.Office.Tools.Excel.NamedRange = _
        Me.Controls.AddNamedRange(Me.Range("A1"), _
        "NamedRange1")

        Globals.ThisWorkbook.SmartTagOptions.EmbedSmartTags = True
        Globals.ThisWorkbook.Application.SmartTagRecognizers.Recognize = True

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

        MsgBox("There are " & Me.SmartTags.Count.ToString() & _
            " smart tags in this document.")
End Sub
private void DisplaySmartTags()
{
    Microsoft.Office.Tools.Excel.NamedRange NamedRange1 =
        this.Controls.AddNamedRange(this.Range["A1", missing],
        "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.");
}

.NET Framework 安全性

请参见

参考

WorksheetBase 类

Microsoft.Office.Tools.Excel 命名空间