Implement similar behavior as http:// address for Network File Path in word

In word, enter http://cnn.com and then space. Word will underline http://cnn.com. Right clicking it shows a list of customized popup menu. Hover mouse over the text. A tool tip shows up saying "Ctrl+Enter to follow link". I would like to implement the similar behavior for Network File Path.

Is this possible using a pure VSTO and managed code to implement it

Thanks very much!

Yuhang.



Answer this question

Implement similar behavior as http:// address for Network File Path in word

  • CAyson

    Hi Yuhang,

    It's probably not possible to recognize text as fast as office recognizes them for http:// highlighting or spell checking. If you just take into account the overhead of the calls between the Office app and the addin e.g. marshalling in and out of the STA. If you have .NET addins there is additional cost of marshalling between COM and .NET.

    The Smart Tag recognizer function that you write does execute in a seperate thread. Other than the obvious suggestions of making your recognizer function as simple as possible I don't know of any other steps that can make it faster.

    Smart Dev newsgroup:

    http://www.microsoft.com/communities/newsgroups/en-us/default.aspx dg=microsoft.public.office.developer.smarttags&lang=en&cr=US

    Office Dev newsgroup:

    http://msdn.microsoft.com/newsgroups/default.aspx dg=microsoft.public.officedev&lang=en&cr=US

    You may be able to use the two newsgroups above to get suggestions from Office folks and developers who have implemented Smart Tag solutions for making you smart tag recognition faster.

    Thanks



  • vectorvictor

    You could use smart tags implemented in managed code. In case you are not aware of smart tags they are those little icons that pop up when you type certain text e.g. type your address in Word and press enter. This won't give you the Ctrl-Enter experience though.

    VSTO does make the job of implementing smart tags easier but VSTO customizations only load on a per document basis. So, if you would like to restrict your functionality to specific documents that you create, then VSTO is the way to go.

    VSTO Smart Tag resources:
    http://blogs.msdn.com/pstubbs/archive/2005/02/08/369245.aspx

    Demo: http://blogs.msdn.com/vsto2/archive/2005/02/09/370198.aspx

    http://msdn2.microsoft.com/en-us/library/ms178787.aspx

    Sample: http://msdn2.microsoft.com/en-us/library/ms268892.aspx

    ----------------------------------
    If you would like your smart tag to be available application-wide i.e. in any Word document opened on the machine, then you would have to either:

    1. If your smart tag actions are simple, create an XML file that conforms to MOSTL schema. This file describes the pattern to recognize and the action to perform. Just copy the XML file to the Word install folder and your smartag is installed.

    2. If your smart tag actions require more logic, then you need to implement an addin for Word. You can implement Office addins in manged code (without VSTO technology). Office still loads then as COM addins but CLR marshalls the calls to .NET code.

    Both the scenarios are well described in this article http://msdn.microsoft.com/msdnmag/issues/05/02/ManagedSmartTags/default.aspx

    There are lot of other resources available online for Smart Tag development and .NET addins that load via COM addin mechanism. Finally, there may already be third party smart tags available that meet your requirement. I hope this information helps.



  • WizMan

    It helps. One issue with smarttag is it is slow in recognizing tags. With http://, the text is marked right way.

    Is there a way to accelarate the process of recognizing smart tag

    Thanks,

    Yuhang


  • Implement similar behavior as http:// address for Network File Path in word