Smart Tags Overview
Applies to |
---|
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office. Document-level projects
Application-level projects
For more information, see Features Available by Application and Project Type. |
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, a list of stock-related actions, such as looking up a stock price on the Internet, could appear.
Visual Studio Tools for Office provides classes 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.
Note
To create smart tags in an application-level add-in, you must have Visual Studio 2008 Service Pack 1 (SP1).
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.
Features of Visual Studio Tools for Office Smart Tags
When you write code for smart tags in a Visual Studio Tools for Office 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 Visual Studio Tools for Office 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.
Starting in Visual Studio 2008 SP1, you can 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).
Note
To add an application-level smart tag to a project that you created before you installed SP1, you must first modify the project to generate some necessary code. For more information, see How to: Add Application-Level Smart Tags to Projects That Were Created Before SP1.
Deployment
Visual Studio Tools for Office smart tags are part of the Visual Studio Tools for Office project, so no separate deployment is necessary for them. There is also no need to set security policy specifically for the smart tags; they will run when security is set for the solution.
Registration
You do not need to register the smart tags. Visual Studio Tools for Office registers the smart tags for you, creating one registry entry that includes all the Visual Studio Tools for Office smart tags.
Creating Smart Tags in Applications Other Than Word and Excel
You can use the smart tag classes provided by Visual Studio Tools for Office only in projects for Word and Excel. However, other Microsoft 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 instead of Visual Studio Tools for Office. There are two main steps in this process:
Create a smart tag DLL (either a managed assembly or an unmanaged DLL) that implements the required ISmartTagRecognizer and ISmartTagAction COM interfaces.
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 a Visual Studio Tools for Office add-in. 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.
See Also
Tasks
How to: Enable Smart Tags in Word and Excel
How to: Add Smart Tags to Word Documents
How to: Add Smart Tags to Excel Workbooks
How to: Add Application-Level Smart Tags to Projects That Were Created Before SP1
How to: Create Smart Tags With Custom Recognizers in Word
How to: Create Smart Tags With Custom Recognizers in Excel
Walkthrough: Creating a Smart Tag by Using a Document-Level Customization
Walkthrough: Creating a Smart Tag by Using an Application-Level Add-In
Concepts
Change History
Date |
History |
Reason |
---|---|---|
July 2008 |
Added information about application-level add-ins. |
SP1 feature change. |