How to create smart tags in Delphi
for Microsoft Word, Excel, Outlook and PowerPoint
Add-in Express VCL and smart tags
With Add-in Express you can develop Smart Tags for Word, Excel, PowerPoint and Outlook (with Word as a default e-mail editor). The Add-in Express architecture makes possible to create several smart tags within one project and one recognizer. So, you will not have to learn smart tag interfaces (ISmartTagRecognizer, ISmartTagAction, etc.), just by following the eight steps below, you can develop, compile, register, and test your Smart Tag DLL in about 20 minutes.
The sample below describes creating a smart tag for Microsoft Word 2007 and Excel 2007. In the Add-in Express Developer Guide, you will find one more smart tag example.
1. Create a smart tag library with Add-in Express wizard
In the Delphi IDE, close all opened projects, select the "File|New|Other:" item on the main menu, and run the "Add-in Express Smart Tag" wizard on the "Add-in Express" tab of the "New Item" dialog box. Enter your project name, the coclass name and the destination folder, click Next and then click Finish. The wizard generates a new project and opens it in the Delphi IDE.
In the wizard you can also specify if your smart tag should be installed with administrative or user privileges.
2. Name your smart tag library
In the Project Manager window, select the Smart Tag module (MySmartTag1_IMPL.pas on the figure above), activate theObject Inspector, name your Smart Tag library via the SmartTagName property (this name will appear in the AutoCorrect dialog box of host applications).
3. Add a new smart tag
In the Smart Tag module, select the Add-in Express tab on the Component Palette and add adxSmartTag to the module.
4. Customize your smart tag
In Object Inspector, name the Smart Tag pop-up via the Caption property and specify the DonwloadURL.
5. Add recognizable phrases
To add words or phrases to be recognized by your Smart Tag, simply specify them in the RecognizedWords collection.
6. Add new items to the smart tag pop-up
To add new items to the Smart Tag pop-up, populate the Actions collection. Every item of the collection is associated with the corresponding pop-up item.
7. Handle the Click event of pop-up items
To handle the click event of a pop-up item, select the corresponding action object, and, in the Events tab of the Object Inspector, double click on the OnClick event, and enter the code you need. For example:
8. Register and run your smart tag
Save the project, compile it, close Word and Excel, and register the Smart Tag library via "Run|Register ActiveX Server". Run Word or Excel and enter the phrases you specified as recognizable.
See also how to develop a smart tag in .NET.