Making Word Documents Smart

VSTO enables you to create smart tags in your Word solutions. For example, if a user types a company name in the document, you can add code that will recognize the name and add an action. Figure 6.23 shows an example of a built-in smart tag that recognizes names in your document. When the term has been recognized as a smart tag, it is marked with a dotted underline. Then when you hover over the name, a dropdown list appears, where you can click to choose the desired action.

You can create your own smart tags and actions using VSTO. These smart tags differ from those you create outside VSTO in that VSTO smart tags are specific to a particular document rather than to any document that is opened. You will learn more about smart tags in Chapter 9.

If you're familiar with smart documents, you'll definitely want to learn more about VSTO's implementation of the ISmartDocument interface

Kathies fiJMtGrath

pi

F*r»n Name: Kathtew McGfrth

SwdöaJ k

ScfetdJe dieting Open Contact âdd to Contact! IfMrt Addiitt

Remove this Smart Tag

S^cç ftwogremj "K4thift«i McGrattT »

Jroart TagOpWons...

Figure 6.23. Displaying the actions for a smart tag

Figure 6.23. Displaying the actions for a smart tag through the ActionsPane object. The ActionsPane object enables you to customize the Document Actions task pane in Word and Excel using only a few lines of code. By adding a single control to the Controls collection of the actions pane, you can create and display the Document Actions task pane and then show and hide controls in response to actions that users take within the document. Earlier in this chapter you saw an example of how to add and remove such a control (Listings 6.30 and 6.31). Chapter 5 describes how to customize the document-level task pane, and Chapter 14 describes how to customize the application-level task pane through an add-in.

0 0

Post a comment