Software

Build Your Skills: Learn to use Office XP's smart tags

Use smart tags to identify data types in Microsoft Office XP


You may know that one of the new features in Office XP is something called smart tags, and you've probably noticed those funny little icons that pop up in your documents from time to time. But are you taking advantage of all that smart tags can do? In this Daily Drill Down, we'll explore the technology behind smart tags and show how you can use the smart tags built into Word 2002 and Outlook 2002. We'll also discuss how you can create your own smart tags and how they can be added to Web pages.

What are smart tags and how do they work?
Smart tags are a way of annotating the content (text, pictures, etc.) in documents based on the type of information that is represented by that word, number, phrase, or picture. For example, a group of words such as "Deb Shinder" is recognized as a person’s name, while the number combination "102 Main Street" is recognized as a street address.

These bits of data are then tagged to identify them according to their content type.

Smart tags "under the hood"
Smart tag technology is based on XML (eXtensible Markup Language), which is used to define and categorize content. XML is known as a meta language; it defines how you create tags to identify content types (tags for the above content types, for example, could be noted as <name> and <address>). These tags that identify the nature of the content are called elements. In XML markup—and also in HTML—they surround the content they are tagging. Thus you would identify a name by enclosing it with a start tag and an end tag:
<name> Deb Shinder </name>

More on XML
You don’t have to understand XML to use smart tags, but if you’re interested in more detailed information about this underlying technology, see this Technical Introduction to XML.

How smart tags are used
What good is the ability to identify these different types of content within a document, such as a letter created in your word processor or a Web page viewed in your browser? Identifying content provides the ability to link that content to other information or actions that can be performed for content of that type. For example, if the tagged content is identified as a person’s name, you can perform certain actions associated with people, such as sending them e-mail or adding them to your contacts list.

XML tags can be used for a variety of purposes. Software can be written to extract the tagged data and sort it, display it, manipulate it, etc. In Microsoft’s Office XP (and in the current betas of Office 11), smart tags are linked to specific actions. They serve as shortcuts to performing actions that would otherwise require several steps to perform. The available actions depend on the content type of the tagged data.

Is it smart to use smart tags?
Not everyone is enamored with the smart tag concept. In fact, it engendered a lot of criticism in 2001 with the impending release of Windows XP. A number of critics questioned whether the tag support in the beta version—which provided smart tag-inserted links based on keywords on any Web page viewed with MSIE 6—could be used for nefarious purposes, such as steering surfers to Microsoft-approved sites. This led Microsoft to exclude the feature in the final release of the operating system.

How to disable smart tags
Web authors who are worried about auto-generated smart tags (which may make a comeback in future versions of MSIE) can add a meta tag to each of their pages that will prevent any tags from appearing on their pages. To disable smart tags, the following code should be included in the HEAD of the page:
<META NAME="MSSmartTagsPreventParsing" CONTENT="TRUE">


Using smart tags
Using smart tags in Office is easy. When content is recognized as a type defined by smart tags, a dotted-line indicator appears under the tagged data. The indicator appears after you type the text (in Word, it actually appears the next time you press [Enter] to start a new paragraph). A smart tag action button (see Figure A) will appear when your cursor moves over the tagged text.

Figure A
Tagged content is marked by a dotted underline and an action button indicator.


Using smart tags in Word and Excel
The first step in using smart tags in Word and Excel is to turn on the feature. This is done by selecting the Autocorrect Options from the Tools menu, and then selecting the Smart Tags tab. The appearance differs slightly depending on which program you’re using (see Figure B and Figure C).

Figure B
Word allows you to define content types that will be recognized as smart tags.


In Word 2002, there are several default content types that can be recognized: person names, dates, times, addresses, places, telephone numbers, recent Outlook e-mail recipients, and financial symbols. You can add additional tags by clicking the More Smart Tags button.

Figure C
Excel’s smart tag configuration tab is more limited than the configuration tab in Word.


Excel 2002 includes two default content types: recent e-mail recipients and financial symbols. Again, you can add others.

For either program, smart tags are turned on by checking the Label Data With Smart Tags Checkbox.

Turning off the dotted underline
If you don’t want to see the dotted underline that marks tagged content, you can hide it without turning off smart tags. Select Options from the Tools menu, click the View tab, and under the Show section, uncheck Smart Tags.

Now you can start using smart tags. In Word, just put your cursor over any tagged content (identified by a dotted underline) and click the small down arrow on the indicator. This will open a menu that shows the available actions for that type of content, as shown in Figure D.

Figure D
Click the down arrow on the action button to display the action menu.


For a person’s name, available actions include sending e-mail, scheduling a meeting, opening the contact record, adding the name to the contacts list, or inserting an address. You can also remove the smart tag or open the Smart Tags dialog box (the same box shown in Figure B).

If the content is a telephone number, you’ll only be given the option to add it to your contacts. If the content is an address, you can add it to contacts, display a map, or display driving directions (the last two selections link to the MSN Maps and Directions Web site). For dates and times, you can schedule meetings or display your calendar.

Compare this one-click ease with the steps that would be required, for example, to add a name to your contact list (open Outlook, open Contacts, then type the name for the new contact or copy and paste it from the Word document).

File size will increase
Be aware that smart tags increase the file size of your document. You can decrease the size by choosing not to save the smart tags. Click Tools | Options | Save and uncheck the Embed Smart Tags box.

Using smart tags in Outlook
If you use Word as your Outlook e-mail editor, your smart tags can be embedded in the e-mail messages, although you can’t use smart tags in the subject line. The e-mail recipient will have to be using Outlook 2002 as the e-mail client in order to use the smart tags.

You can configure whether smart tags will be saved in e-mail messages by clicking (in Word) Tools | Options | General, clicking the E-mail Options button and then the second General tab, and checking or unchecking Save Smart Tags In E-mail.

Outlook also supports the Paste Options smart tag, which is available in other Office programs. This tag works a little differently from those we’ve described previously. It recognizes text that has been pasted into a document, and displays a special smart tag indicator with a picture of a clipboard. Clicking the drop-down menu gives you the following choices:
  • Keep The Source Formatting
  • Match The Destination Formatting
  • Keep The Text Only, With No Formatting
  • Apply A Style Or Formatting

Adding smart tags to Web pages
The smart tag feature in beta versions of MSIE 6 created links that were automatically generated by the browser software, as opposed to HTML links that are embedded in the page by the Web designer. This is the technology that caused an uproar in the Internet community and was subsequently dropped from the final product.

However, Web page authors can add smart tags to their pages, whether they compose the HTML using a text editor such as Notepad or a WYSIWYG product such as FrontPage. Users will need Office XP or other smart-tag-aware software to view the tags. For instructions see Adding Smart Tags to Web Pages on the MSDN site.

You can also save Word documents (including those with smart tags) as Web pages. For compatibility, you should save the smart tags as XML. To do this, click Tools | Options, then select the Save tab. Under Save options, check the box labeled Save Smart Tags As XML Properties In Web Pages.

Getting additional tags and creating your own smart tags
The default smart tags that come with the Office programs are handy, but you might be able to think of other content types and actions that would make the smart tag feature even more useful. Luckily, you can download more smart tags from the Web, your company’s programmers can develop tags that are customized for your organization and make them available on the local network, or you can even create your own.

Downloading additional tags
To download new tags from Microsoft and its partners, click the More Smart Tags button on the smart tags dialog box. This will open the Office Update Web site. You’ll find many different types of tags here, including:
  • ESPN tags that recognize baseball team and player names; actions allow you to retrieve statistics about them with a single click of the mouse.
  • Expedia tags that recognize destination place names and include actions to link to Expedia services, maps, and travel guides.
  • FedEx tags that let you check addresses and track shipping of packages.
  • LexisNexis tags that recognize names of court cases and link you to the associated court opinions, reviews, and news.
  • MSNBC city tags that recognize city names and link you to local news, weather, and sports information.

Download smart tags from Microsoft
To get more smart tags, you can go directly to Microsoft’s smart tag download page. Note that some tags may have requirements in addition to Office XP being installed. For example, to use the LexisNexis tags, you need a subscription to the LexisNexis service.

To install new smart tags, you’ll generally need to download an executable file. For example, the MSNBC city tag is an 86-KB file named smarttags.exe. Select the option to run the program from its current location. The setup program—in this case, the MSNBC.com Smart Tags Setup Wizard—will run. After installation is complete, go to the smart tags configuration dialog box and check Smart Tag Lists. You may need to close all Office XP applications and restart before the new tag can be used.

You can also find downloadable smart tags on third-party sites.

Figure E shows how the newly installed World Lingo smart tag works. It was downloaded from WorldLingo's smart tags Web site.

Figure E
WorldLingo's smart tags recognize country names.


This tag recognizes country names. For example, Figure E shows the drop-down menu you'll see when you select Mexico in the text of a document. When you choose Get This Term Explained, the smart tag sends you to WorldLingo's country profile of Mexico. The profile contains information such as the capital city, languages, population, currency, and more.

Creating your own tags
The easiest way to create your own smart tags is to use Microsoft’s ActiveDocs. This is an add-on document automation application for Word that provides authoring tools and other features, including the Smart Tag Wizard. The Wizard has a point-and-click interface that makes it simple to create smart tags even if you’re not a programmer. You can download a free 21-day trial version of ActiveDocs.

Programmers can create smart tags using the Office XP Smart Tag Software Developers’ Kit (SDK), which can be downloaded from the MSDN Web site. Creating a smart tag requires that you create two COM DLLs. One is the recognizer (the code that identifies the content type), and the other is the action (the code that executes the commands to perform some task). Developers can use the Visual Studio Installer to make smart tag installation packages so that others can easily install and use the smart tags they’ve created.

More on developing smart tags
For a tutorial on how to create a smart tag (along with sample code) see the MSDN article Developing Simple Smart Tags.

Troubleshooting smart tags
If you download a new smart tag and it doesn’t seem to work, be sure that you have closed all Office programs before reopening. This includes Outlook, if Word is your e-mail editor.

Your newly installed smart tag still may not work until you go to the smart tags configuration dialog box and select Recheck Document.

If you’ve turned off smart tags and you’re still seeing smart tag indicators in your documents, this may be because you copied and pasted text that had a smart tag in it. You can delete each smart tag by selecting that option in its action menu, or you can delete all smart tags by opening the smart tags configuration dialog box and clicking the Remove Smart Tags button.

Your smart tags will disappear under some circumstances:
  • When you protect a document as a form, smart tags become unavailable.
  • When you copy and paste text containing a smart tag from Word to Excel, if you copy more than the smart tag itself, the tags will disappear when pasted into Excel.
  • Smart tags may be lost when you save the document as a Web page.
  • Smart tags are lost if you save a document in rich text or plain text.

Assessing the value of smart tags
Are smart tags evil, as some critics have suggested, or the best thing since sliced bread, as Microsoft would have you believe? As usual, the truth probably lies somewhere in between. Smart tag technology can help you get tasks done more quickly and easily than before. They can also make it a snap to cull information from documents, or link to relevant information on the Web or elsewhere. But if you don’t like them, it’s easy to turn them off, as I've shown you.

About Deb Shinder

Debra Littlejohn Shinder, MCSE, MVP is a technology consultant, trainer, and writer who has authored a number of books on computer operating systems, networking, and security. Deb is a tech editor, developmental editor, and contributor to over 20 add...

Editor's Picks

Free Newsletters, In your Inbox