Introduction to Smart Tags

The Smart Tags feature of Word and Excel enables you to display a pop-up menu with actions for a given piece of text in a document or spreadsheet. For example, a Smart Tag could recognize stock symbols (such as the MSFT stock symbol) and display a set of actions that can be taken for that symbol. When Word finds a piece of text that a Smart Tag has recognized, it displays a red dotted underline under the recognized text. If the user hovers over the text, a pop-up menu icon appears next to the cell, as shown in Figure 16-1. If the user clicks the pop-up menu icon, a menu of actions displays for the recognized piece of text, as shown in Figure 16-2. When an action is selected, Word calls back into the Smart Tag to execute the action.

Figure 16-1. Some recognized text in Word.

Figure 16-2. Dropping down the Smart Tag menu in Word.

When Excel recognizes a Smart Tag, it displays a little triangle in the lower-right corner of the associated cell. If the user hovers over the cell, a pop-up menu icon appears next to the cell that the user can click to drop down a menu of actions for the recognized piece of text. Figure 16-3 shows an example menu. When an action is selected, Excel calls back into the Smart Tag to execute the action.

Figure 16-3. Dropping down the Smart Tag menu in Excel.

Figure 16-4 shows some additional detail about the drop-down menu that appears for recognized text. At the top of the drop-down menu, the name of the Smart Tag displays along with the text that was recognized. The next section of the menu shows actions that are available for the given Smart Tag. This particular Smart Tag, called Financial Symbol, has four actions associated with it. The bottom section of the menu provides Word- or Excel-specific options for the Smart Tag.

Figure 16-4. The Smart Tag menu.

 

Configuring Smart Tags in Word and Excel

Smart Tags in Word are managed from the Smart Tags page of the AutoCorrect Options dialog shown in Figure 16-5. The Smart Tags page can be displayed by choosing AutoCorrect Options from the Tools menu. Here the user can turn on and off individual Smart Tags as well as control other options relating to how Smart Tags display in the document.

Figure 16-5. Word's Smart Tags page in the AutoCorrect dialog.

Smart Tags in Excel are managed from the Smart Tags page of the AutoCorrect dialog, as shown in Figure 16-6. The Smart Tags page can be displayed by choosing AutoCorrect Options from the Tools menu. Here the user can turn on and off individual recognizers as well as control other options relating to how Smart Tags display in the workbook.

Figure 16-6. Excel's Smart Tags page in the AutoCorrect dialog.

 

The Persistent Tagging Generated by Smart Tags

To understand how Smart Tags work in Office, it is helpful to have a conceptual model in your mind. Otherwise, some of the behavior you will see when working with Smart Tags will be confusing.

A Smart Tag has a recognition engine that is passed text in the document or workbook. If the Smart Tag recognizes a segment of text, it can tell Word or Excel to tag the text as being recognized. This tagging is stored and saved in the document by Word or Excel. When text is tagged, it remains tagged until the user removes the tag by choosing Remove This Smart Tag from the Smart Tag menu. So even if a Smart Tag has stopped recognizing a particular term or is no longer active, the tagging in the document can remain.

Text that has been tagged by a Smart Tag has its tagged state saved into the document. You can see this tagging when you save into WordML format. A document with the stock symbol MSFT has been recognized in a Word document by a Smart Tag with Smart Tag type name customsmarttag. This tag also can optionally store custom properties in the document when it recognizes a termin this example, the Smart Tag stores the properties LongStockName and the current StockValue. You can see all this in the WordML markup:

MSFT







Visual Studio Tools for Office(c) Using C# with Excel, Word, Outlook, and InfoPath
Visual Studio Tools for Office(c) Using C# with Excel, Word, Outlook, and InfoPath
ISBN: 321334884
EAN: N/A
Year: N/A
Pages: 214
Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net