private void AddSmartTagToDocument(Word.Document document)
        {
            Microsoft.Office.Tools.Word.SmartTag smartTagDemo =

                Globals.Factory.CreateSmartTag(
                    "www.microsoft.com/Demo#DemoSmartTag",
                    "Demonstration Smart Tag");

            // Specify the terms to recognize.
            smartTagDemo.Terms.Add("term");
            smartTagDemo.Terms.Add("recognize");

            displayAddress = Globals.Factory.CreateAction("To be replaced");

            // Add the action to the smart tag.
            smartTagDemo.Actions = new Microsoft.Office.Tools.Word.Action[] {
                displayAddress
            };

            Microsoft.Office.Tools.Word.Document vstoDocument =
                Globals.Factory.GetVstoObject(document);
            // Add the smart tag to the document
            vstoDocument.VstoSmartTags.Add(smartTagDemo);

            displayAddress.BeforeCaptionShow += new
                                                Microsoft.Office.Tools.Word.BeforeCaptionShowEventHandler(
                displayAddress_BeforeCaptionShow);

            displayAddress.Click += new
                                    Microsoft.Office.Tools.Word.ActionClickEventHandler(
                displayAddress_Click);
        }
        void displayAddress_BeforeCaptionShow(object sender,
                                              Microsoft.Office.Tools.Word.ActionEventArgs e)
        {
            Microsoft.Office.Tools.Word.Action clickedAction =
                sender as Microsoft.Office.Tools.Word.Action;

            if (clickedAction != null)
            {
                clickedAction.Caption = "Display the location of " +
                                        e.Text;
            }
        }