This documentation is archived and is not being maintained.

Smart Tags Overview

Smart tags are strings of text that have type information attached to them; when a text string that matches the criteria appears in a document, it is recognized and the user can perform actions appropriate for that type of string. For example, you could create a smart tag that recognizes stock symbols. When the user types an uppercase string of four letters, you could provide a list of stock-related actions, such as looking up a stock price on the Internet.

Applies to: The information in this topic applies to document-level projects and application-level projects for Excel 2007 and Word 2007. For more information, see Features Available by Office Application and Project Type.

The Office development tools in Visual Studio provide APIs that you can use to quickly add smart tags to Microsoft Office Word documents and Microsoft Office Excel workbooks. For examples that demonstrate how to use these classes, see How to: Add Smart Tags to Word Documents and How to: Add Smart Tags to Excel Workbooks.

To run a smart tag, end users must have smart tags enabled in Word or Excel. For more information, see How to: Enable Smart Tags in Word and Excel.

To create a smart tag for an application other than Word or Excel, you must use the Smart Tag SDK. For more information, see Creating Smart Tags in Applications Other Than Word and Excel.

Important noteImportant

Smart tags are deprecated in Excel 2010 and Word 2010. Although you can still use the related APIs in projects for Excel 2010 and Word 2010, these applications do not automatically recognize terms, and recognized terms are no longer underlined. Users must trigger recognition and view custom actions associated with text by right-clicking the text and clicking the Additional Actions on the context menu. For more information about this change in Word 2010, see For more information about this change in Excel 2010, see

When you write code for smart tags in a project for Word or Excel, you get IntelliSense, integrated Help, and the other features of Visual Studio. All of the code for the smart tags is in one class; you do not have to create a separate actions class and recognizer class. For more information about the smart tag classes, see Smart Tags Architecture.

Document Scope

Smart tags that you create by using the Office development tools in Visual Studio behave differently in document-level projects and application-level projects.

If you create a smart tag in a document-level customization, the smart tag runs only in the document that is part of the customization, not in every open Word or Excel document. This means that you can recognize text that might be too general to recognize if the smart tag is applied to multiple kinds of documents. For example, in an invoice a five-digit number might represent only a product number, but it might represent an employee number in a human resources document. If the smart tag works only in the invoice, you do not need to worry that it will incorrectly recognize and assign actions to an employee number.

If you create a smart tag in an application-level add-in, you can make the smart tag available only to a specific document, or to every document that is opened in Word or Excel (this type of smart tag is also named an application-level smart tag).

Deployment and Registration

Unlike smart tags created by using the Smart Tag SDK, no separate deployment or registration is required for smart tags created by using the Office development tools in Visual Studio. There is also no need to set security policy specifically for the smart tags; they will run when security is set for the solution.

You can use the smart tag classes provided by the Office development tools in Visual Studio only in projects for Word and Excel. However, other Office applications also support smart tags, such as PowerPoint and Outlook (when Word is used as the e-mail editor). To create a smart tag for these applications, you must use the Smart Tag SDK. There are two main steps in this process:

  1. Create a smart tag DLL (either a managed assembly or an unmanaged DLL) that implements the required ISmartTagRecognizer and ISmartTagAction COM interfaces.

  2. Deploy the smart tag DLL to end user computers, and create the required registry keys that enable Microsoft Office applications to discover the smart tag DLL.

For more information, see the Smart Tag SDK documentation in the MSDN Library.

Typically, you should not implement the smart tag COM interfaces in an add-in created by using one of the Office project templates in Visual Studio. Instead, implement them in a different assembly or unmanaged DLL. Otherwise, redundant code will be loaded into memory because the add-in assembly will be loaded twice by the Office application: one time when the application loads your add-in, and again when the application discovers and loads smart tag DLLs that are installed on the system. Each instance of the add-in assembly will be loaded into a separate application domain.