
f you developed smart tags in Office XP, you'll be interested in the changes in Office 2003. Smart tag technology links text to resources that provide relevant information useful in creating a document. Or even better, relevant information can be inserted right into the document itself. Smart tags in Microsoft Office 2003 have been improved to make them even easier to develop, and they conquer a few limitations.
Smart tags were introduced in Microsoft Office XP, providing a new way to make more meaningful data in documents. A major change in Office 2003, the number of applications supporting smart tags has increased. In Office XP, smart tags were supported in Word, Excel, Outlook (with Word as the e-mail editor), and Internet Explorer, to a limited extent. In Office 2003, all these applications are supported and both PowerPoint 2003 and Access 2003 have been added.
New features have been added to the Microsoft Office Smart Tag Lists (MOSTL). MOSTL provides the capability to define smart tag recognizers in XML. Although it's not as flexible as implementing smart tags in a programming language, it's great when you have an easily defined list of words or phrases to be recognized. You can use regular expressions to define search patterns for your recognizer and you'll see a few examples using MOSTL and regular expressions later in this article.
In addition, the API library has been extended, supporting several new interfaces and enabling new functionality. The Microsoft Smart Tags 2.0 Type Library is backward compatible with the 1.0 version, allowing you to develop smart tags that work in both Office XP and Office 2003. This type library and an example of implementing a smart tag in .NET are discussed in more detail later in this article.
An Introduction to Smart Tags
Smart Tags identify words or phrases within a document, and several are provided with Microsoft Office. For a list of existing smart tags, and to enable and disable smart tags, go to
Tools (from within any of the applicable Office 2003 applications) and then choose
Auto Correct Options. Click on the
Smart Tags tab and you'll see a list of available smart tags.
 | |
| Figure 1: The smart tag shows the financial symbol and its smart tag drop-down menu. |
To experiment, enable the
Financial Symbols smart tag. Then enter a stock symbol, such as MSFT, in a Word 2003 document. When the symbol is recognized, smart tags make a red-dotted underline under it. When you hover your mouse pointer over it, you'll see an information icon. Clicking on the icon displays a drop-down menu, as shown in
Figure 1. The menu shows a list of actions relevant to the financial symbol.
Another smart tag might look up contact information in your Outlook 2003 contact list.
Figure 2 shows the drop-down menu and the actions available with that smart tag.
Although these are good examples of smart tags in action, the number of provided smart tags is limited. It is possible to create your own smart tags using MOSTL or by developing them in a programming language. Then the possibilities of what you can do with smart tags are virtually endless!
 | |
| Figure 2: The Outlook Contact List smart tag drop-down menu includes common tasks. |
Microsoft Office Smart Tag Lists (MOSTL)
Smart tag lists define smart tag recognizers and actions in XML. For example, you can create a MOSTL file that recognizes the terms VB.NET, C#, ADO.NET, and ASP.NET. The smart tag links to the MSDN Library Web site using a listing like the one you'll see in
Listing 1.
This XML file needs to be stored in the directory C:\Program Files\Common Files\Microsoft Shared\Smart Tags\Lists.
If any Office 2003 applications are open, you must close them and re-open them to get the new smart tag recognized. Once you have done this, the new smart tag shows up on the Smart Tags tab of the Auto Correct dialog box (via the Tools menu). As long as that smart tag is enabled, when you enter any of the terms the smart tag recognizes, you'll be able to link to the MSDN Library Web site, as shown in
Figure 3.
 | |
| Figure 3: The custom smart tag defined in Listing 1 allows access to the MSDN Library for the term ADO.NET. |