SmartTagCollection Interface

 

Represents a collection of smart tags in a Word or Excel solution created by using the Office development tools in Visual Studio.

Namespace:   Microsoft.Office.Tools
Assembly:  Microsoft.Office.Tools.Common (in Microsoft.Office.Tools.Common.dll)

[GuidAttribute("30a90086-8c89-4e19-8299-47765d808408")]
public interface SmartTagCollection : IEnumerable, IDisposable

NameDescription
System_CAPS_pubpropertyItem[Int32]

Gets the smart tag at the specified index.

This type or member is intended to be used only in projects for the 2007 Microsoft Office system. Smart tags are deprecated in Office 2010.

.

NameDescription
System_CAPS_pubmethodAdd(SmartTagBase)

Adds a smart tag to the end of the SmartTagCollection.

This type or member is intended to be used only in projects for the 2007 Microsoft Office system. Smart tags are deprecated in Office 2010.

.

System_CAPS_pubmethodAddRange(SmartTagBase[])

Adds an array of smart tags to the end of the SmartTagCollection

This type or member is intended to be used only in projects for the 2007 Microsoft Office system. Smart tags are deprecated in Office 2010.

.

System_CAPS_pubmethodContains(SmartTagBase)

Determines whether the SmartTagCollection contains a specific smart tag.

This type or member is intended to be used only in projects for the 2007 Microsoft Office system. Smart tags are deprecated in Office 2010.

.

System_CAPS_pubmethodCopyTo(SmartTagBase[], Int32)

Copies the smart tags in the SmartTagCollection to a one-dimensional array of smart tags, starting at a specified index.

This type or member is intended to be used only in projects for the 2007 Microsoft Office system. Smart tags are deprecated in Office 2010.

.

System_CAPS_pubmethodDispose()

(Inherited from IDisposable.)

System_CAPS_pubmethodGetEnumerator()

(Inherited from IEnumerable.)

System_CAPS_pubmethodIndexOf(SmartTagBase)

Determines the index of a specified smart tag in the SmartTagCollection.

This type or member is intended to be used only in projects for the 2007 Microsoft Office system. Smart tags are deprecated in Office 2010.

.

System_CAPS_pubmethodInsert(Int32, SmartTagBase)

Inserts a smart tag into the SmartTagCollection at the specified index.

This type or member is intended to be used only in projects for the 2007 Microsoft Office system. Smart tags are deprecated in Office 2010.

.

System_CAPS_pubmethodRemove(SmartTagBase)

Removes a smart tag from the SmartTagCollection.

This type or member is intended to be used only in projects for the 2007 Microsoft Office system. Smart tags are deprecated in Office 2010.

.

When you create a smart tag, you add a SmartTagBase object to the Workbook.VstoSmartTags or Document.VstoSmartTags properties. These properties have the type SmartTagCollection.

System_CAPS_noteNote

This interface is implemented by the Visual Studio Tools for Office runtime. It is not intended to be implemented in your code. For more information, see Visual Studio Tools for Office Runtime Overview.

This type is intended to be used only in projects for Excel 2007 and Word 2007. Smart tags are deprecated in Excel 2010 and Word 2010.

This documentation describes the version of this type that is used in Office projects that target the .NET Framework 4 or later. In projects that target the .NET Framework 3.5, this type might have different members and the code examples provided for this type might not work. For documentation about this type in projects that target the .NET Framework 3.5, see the following reference section in the Visual Studio 2008 documentation: http://go.microsoft.com/fwlink/?LinkId=160658.

The following code uses the Add method to add a Microsoft.Office.Tools.Excel.SmartTag to the collection of smart tags exposed by the Workbook.VstoSmartTags property. This code example is part of a larger example provided for Microsoft.Office.Tools.Excel.Action.

This example is for a document-level customization.

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);
}
Return to top
Show: