![]() |
![]() |
All Products | Support | Search | microsoft.com Home | |
![]() |
|||
Home | Register Books | Newsletter | Site Index | Book Lists | |
|
![]() |
![]() |
|
![]() | ||||||||||||||||||||||||||||
![]() Microsoft
Office XP and Smart Tags: Got Bot? ![]() Developing for Microsoft® Office just got exciting again. Microsoft Office XP offers a platform that allows you to provide your end users with a unified desktop environment that integrates their everyday productivity tools with relevant Web-based information delivered just when they need it. This release of Microsoft Office even includes a version, Microsoft Office XP Developer, with a feature set designed especially for the developer. Whether you're a brand-new developer or a seasoned pro—or somewhere in between—the best place to learn about the new features for developers in Microsoft Office XP is to pick up a copy of Microsoft Office XP Developer's Guide from Microsoft Press®. This essential guide covers everything from the nuts and bolts of Visual Basic® for Applications (VBA) and good coding practices to advanced topics such as developing workflow applications and using digital dashboards. What I really like about this book is that it also includes information on localization and deployment. These are both critical topics in today's increasingly interconnected workplace; unfortunately, they are often overlooked in books for developers, leaving us to learn about best practices through trial and error—often mostly error. To get a feel for the book, check out the table of contents and even read Chapter 12, “Sharing Code with the Code Librarian.” Microsoft Office XP has more new features than I can cover in detail in a single article. In this article, I'll focus on what I think is the most exciting new feature: Smart Tags. Because the concept is completely new, I will devote a little extra time explaining what Smart Tags are and how you use them in your applications. I'll then walk you through an example that will demonstrate how you can easily build a Smart Tags-based application for your end users by simply modifying my sample code and copying a single file to the users' machines. Along the way, I will give you pointers about where you can find additional information and learn how to build more complex Smart Tags Office as the Platform for Integrated
Applications What made Office-based applications so valuable (and allowed us as developers to charge big bucks for building them) was their integration. You could develop applications for users whose entire work lives revolved around their favorite productivity application. For example, if you worked for a financial institution and your users were spreadsheet jockeys, you could easily develop an application right inside Microsoft Excel. Not only did your colleagues get an application that looked and acted just like their favorite tool (making it more acceptable to users and at the same time keeping training costs down), but all the data was also in one place. Then the Internet came along. Nowadays, if you want everyone to use your application, it had better run in a Web browser. Although the standardization on the browser has increased productivity, it creates a split work environment for knowledge workers. The problem is that most users consume Web pages—they don't create with them. For example, you are probably pretty savvy when it comes to the Web—certainly more so then the typical knowledge worker. Do you create your work product with a Web browser? Probably not. Even if you create Web pages for a living, your primary tool is probably a text editor, a word processor, or an e-mail client. Of course you often use a Web browser, but you use it for input into the process, not output. Typical knowledge workers are no different. They spend the majority of their time reading and creating documents with Microsoft Word or Excel or using Microsoft Outlook® to collaborate with other users. Often these documents or e-mail messages will include a link to an application on the corporate intranet or to an external Web site. The user will click on the link, read some information on the Web site, and then return to the document and continue working on it with the new information. What is unbelievable to me is that we are so accustomed to this silly, two-step process that we actually consider it an example of good integration between applications. It's like saying that a word processor is integrated with a hardback dictionary. After all, the word processor lets you identify a word that might be misspelled, look it up in the dictionary, and return to the document and correct it if necessary. Maybe I'm just too demanding (or lazy) but if I were a credit manager and I received a document that referenced one of my customers, I would want Microsoft Word to go out and fetch that customer's available credit, payment history, and credit rating and have it waiting for me if I requested it. Sure, this information might be spread out across several internal applications and potentially even on a business partner's extranet, but if I can go find it manually, why can't my software do it for me automatically? Software is supposed to make life easier. I want it to automate the tedious things I could do manually but would rather not. I want a bot. Smart Tags: The Office XP Bot If you haven't seen a demo of the new Smart Tag technology yet, think of it as a cross between hyperlinks and IntelliSense®. Adding hyperlinks to documents is nice but has a few drawbacks. First, there is the dichotomy that I've already mentioned between your everyday tools and the browser. Second, you can only associate a single URL with a text string, so only one action is available. Third, hyperlinks are limited to URL-addressable resources such as Web pages, so you have no way to reference data locked in legacy applications that aren't HTTP-aware. As you would expect, Smart Tags solve all these problems. The Smart Tagfeature has two parts: the underlying architecture and the user interface that exposes that architecture. I'll start with the user interface because that's what you'll see first. Let's say I'm finishing up a letter and I want to include my address under my name. As soon as I press Enter after I type in “Scott Mauvais,” Microsoft Word 2002 recognizes my name as the name of a person and places a purple dotted line under it. When I hover the mouse over the underlined text, the Smart Tag icon (the letter “I” with a circle around it) pops up. I click on the icon to get the list of actions shown in Figure 1.
Like the Smart Tag feature, the Smart Tag architecture has two pieces. The Smart Tag Recognizer analyzes and categorizes your text. As you type, Microsoft Office XP fires up a background thread and passes the text to each of the recognizers installed on your system. If one of them recognizes the text as relevant information, Microsoft Office XP places that purple dotted line underneath the text, as you saw earlier. Microsoft ships several sample recognizers with Microsoft Office XP that recognize things such as addresses, stock ticker symbols, and people's names. To see which recognizers are installed on your machine, go to the Tools menu bar, select AutoCorrect Options, and click on the Smart Tags tab. The list should look something like the one in Figure 2.
Prior to Microsoft Office XP, inserting someone's address meant firing up Microsoft Outlook, searching for the contact, opening the contact, navigating to the address information, copying the information and, finally, pasting the information back in the document. I have higher standards for integration. Not only is this a hassle, but it also leaves you open to those embarrassing cut-and-paste errors. With Microsoft Office XP, all this information is readily available to you where you need it and when you need it. Think of Smart Tags as the JIT information delivery system for knowledge management. Unlike Clippy, this Microsoft Office XP bot does useful stuff. Build Your Own Bot The truly useful implementations of Smart Tags (the ones that will make money for consultants and get in-house developers promoted) will be those that scour everyday Microsoft Word and Excel documents and uncover the hidden nuggets of information that are both specific to the company and relevant to the user. Think about it: every company has many unique terms and associated actions. Before you start building your own Smart Tags, you need to figure out the key pieces of information that people you work with use everyday. For an agent in an insurance company, this might be a claim ID; for an officer in a loan department, it could be a social security number; for a network administrator, it's probably a machine name or IP address. Once you decide on the key terms, you have to decide how you will recognize them in a document and what actions you will present to users. Microsoft Office XP exposes two means of recognizing terms. The easiest way is to use the built-in Smart Tag List recognizer and create a Microsoft Office Smart Tag List (MOSTL) file that allows you to create Smart Tags without any code. Keep in mind that the simplicity of a no-code solution comes with some limits on flexibility. These simple Smart Tags can only recognize terms against a static list, and they support only actions that are URL-addressable. This is not as limiting as it sounds. You can configure your Smart Tag List to automatically update itself on a regular basis. For many common types of terms, such as customer and products, updating works fine as long as the lists are not very long. You should stick to a limit of about 5000 items. You can also pass the Smart Tag text that the user clicked on as a parameter into the Web page you reference. This way you can build any additional business logic required to provide more information on that end. If you need more flexibility, such as database lookups or pattern matching, you can create complex Smart Tags by building your own recognizer. You do this by writing code against the Smart Tag API via COM. All you need to do is implement two interfaces in your DLL: ISmartTagRecognizer and ISmartTagAction. In the next section, you'll learn how to build simple Smart Tags. To learn how to build complex Smart Tags, see Paul Cornell's “Developing Smart Tag DLLs ” article in the May 2001 edition of MSDN®. You'll probably also want to download the Microsoft Office XP Smart Tag SDK 1.1.
Note that the listing here is abridged; to save space, I decided not to list each customer ID. This is the header section. The table that follows the header describes each element: <FL:smarttaglist
xmlns:FL="urn:schemas-microsoft-com:smarttags:list"> Table 1: Header Descriptions
The following section defines the terms that will be recognized: <FL:terms> Table 2: Term Descriptions
The following section defines the actions available to the user when he or she clicks on the Smart Tag: <FL:actions> Table 3: Action Descriptions
There are a few more elements that I did not define. I skipped the ones that deal with automatically updating the MOSTL file by downloading a new one from a central location. To see how to do this, read Paul Cornell's article “Developing Simple Smart Tags.” Now that you know how to create an XML file in the MOSTL format, you can build your own simple Smart Tag. You could start by firing up your favorite text editor, but why bother? It is far easier to download a template I created and modify it for your own uses. Just look for the sections marked TODO: and replace the text with information relevant to you. Deploying Your Bot Now fire up Microsoft Word and test your Smart Tag. If everything is working properly, you will see something like Figure 3 when you enter a Northwind Customer ID in a document and click on the associated Smart Tag.
The best place to start is with the new Microsoft Office XP Developer's Guide. It allows you to exploit the powerful programmability in Microsoft Office XP with authoritative information straight from the Office XP development team. Other titles from Microsoft Press you might want to check out include the following:
Finally, the Inside Out Series from Microsoft Press provides detailed technical information for advanced users. Of particular interest for developers is Microsoft Office XP Inside Out because it will help you better understand what your end users are expecting. For a complete list of titles related to Microsoft development, see the Microsoft Office for Developers page. For additional resources, you will want to click over to the MSDN Online Office XP Resource page. |
![]() ![]() | ||
![]() ![]() | ||
![]() ![]() ![]() ![]() ![]() ![]() ![]() |