Postcode Lookup in Word

This sample demonstrates how to use the postcode lookup web service to add quick address capture to Microsoft Word.

Download the source

Installing & using the SmartTag

After compiling the solution, you must add it to the GAC and register it for COM interop before you will be able to use it from Word. This is done automatically when you build the solution, but must be done manually to use it on another computer using the regasm tool.

Open Microsoft Word and select the Tools > Autocorrect Options menu item. On the Smart Tags tab, ensure that the "Label text with smart tags" option is selected, and the "Integr8 Postcode Lookup" recognizer is selected.

If you do not see the "Integr8 Postcode Lookup" recognizer listed, first ensure that you have correctly installed the assembly as described above. Secondly, Word normally continues running in the background if it has been opened previously, and the list of smart tags is only loaded when Word first opens, so restart your computer.

Once installed, you can type a postcode, optionally followed by a comma and some more address details such and a building name or number or an organisation name. When you press Return at the end of the line, the postcode lookup smart tag will recognise it and show it with a dotted underline.

Recognised postcode & address details

Hover your mouse over the underlined text, and the smart tag button will appear above it. Click this button to display a drop-down list of possible actions.

Postcode lookup actions

Click the "Lookup Postcode" action. The smart tag will now call the postcode lookup web service and retrieve the full address. If you have entered sufficient details of the address so that it cna find a precise address, the full details of the address are inserted into your document.

Full address details added automatically

If you only entered the postcode, or the other address details you entered are ambiguous, the web service will return a list of all matching addresses and the smart tag will display these in a list that you can choose from. Choose an address from this list to insert it into the document.

List of matching addresses

Skip Navigation Links
Request handled by server S1 for client 38.107.179.219 at 22/05/2012 23:54:26