none
How to Grab a word under the cursor within MS Word using VSTO ? RRS feed

  • Question

  • MS Word can grab a word under the cursor.

    You can find this function at "Review tab > Translation group > Mini translator".

    If you hoover mouse over a word, it automatically grabs the word under cursor.

    .

    So, this is inside ONLY function ? Is there any way to use the same function user like me ?

    Show me the way please.

    (I do not need to translate it. I just need to grab it easily and quickly.)

    .

    Regards


    Friday, April 3, 2015 2:16 AM

All replies

  • Please don't create duplicates on the forum. See Reading the word under the cursor within MS Word .
    Friday, April 3, 2015 5:38 AM
  • You are right.

    It is double question.

    It is my fault.

    .

    Can you please move this post to C# or C or whatsoever divisions you think better place than here ?

    VSTO guys has no more knowledge about it, I guess.

    .

    Regards

    Friday, April 3, 2015 6:01 AM
  • I don't think that you can find more suitable forums than VSTO or Word for Developers for such questions.
    Friday, April 3, 2015 7:37 AM
  • I do not think so.

    VSTO is not the end of the world.

    Friday, April 3, 2015 9:00 AM
  • Then why do you post duplicates on the VSTO forum?
    Friday, April 3, 2015 10:41 AM
  • Hi,

    As far as I know, VSTO or word object model doesn’t provide the way for that, I think it needs the windows hook which is not recommended in office development.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, April 8, 2015 8:06 AM
    Moderator
  • Ho..

    First of all, Thanks for the reply.

    I'm not good at C#/C that much. Because I'm a beginner.

    I've learnt C# couple of months ago.

    I'll give it a try.

    Your code looks far and far away from me(I mean looks very difficult to me.)

    Regards


    Wednesday, April 8, 2015 11:17 AM
  • Woo.. first of all it needs Main method (I heard that is the starting point here.).

    I added using directive for dlls, but, I guess, I need some more stuffs.

    Can you give me a little bit specific code, please ?

    Thanks.

    Wednesday, April 8, 2015 11:34 AM
  • Hi,

    For the API issue, I think the C# or .NET Framework Class Libraries forum is the better forum. You may post issue of how to use Win32 API with C# to one of these forums.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, April 10, 2015 8:53 AM
    Moderator
  • Good point.

    I will take a look at the place you recommended with leisure.

    (But,

    If you happend to know(just tell me) the specific codes for this case, it will be very useful to me.)

    Regards





    Friday, April 10, 2015 1:43 PM

  • I checked out APIs you wrote above.

    Your answer is not correct information for this post.

    Your answer is just to grab a title of window.

    That is not the point here.

    And, I could say it is wrong answer.

    Because, For MS Word, it is not work at all.

    Anyways, thanks for your efforts.




    Sunday, April 12, 2015 4:52 AM
  • Hi,

    How do you try it? Please provide the detail information or code.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, April 13, 2015 2:03 AM
    Moderator
  • Just try it.

    All the codes you need are above there.

    It is waste of time to write all of them again.

    Most importantly, it is not working well for this case.



    Monday, April 13, 2015 2:14 AM
  • Hi,

    That is not recommanded in office development too.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, April 15, 2015 3:19 AM
    Moderator
  • Can you tell me the reason why and by whom that is not recommanded ?

    .

    Oh, never mind.

    It is not working well with MS Word.

    .

    Regards

    Wednesday, April 15, 2015 10:12 AM
  • Hi,

    In my opinion, for that way, it needs hook word, which may let the application unstable.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, April 16, 2015 6:02 AM
    Moderator
  • Hi Guys,

    Let's clarify your requirements. Per my understanding, you want to get the related word or words under the cursor using VSTO.

    I assume I understand your requirement corrrectly. Per my experiences, I would suggest you try OCR. I remembered I post the same idea in your another thread.
     
    Generally, there are two steps.
    1. Get the screenshot under the cursor. Note: The screenshot range isn't large.
    2. Get the word from the screenshot. You will use OCR.

    That's my solution.

    But it's very complex. not very easy to achieve. It needs some knowleges about arithmetic.

    Hope this can help you.

    Regards,

    The future belongs to those who believe in the beauty of their dreams.

    Thursday, April 16, 2015 6:10 AM
  • Hi,

    Please check the screenshot animation:

    Regards,


    The future belongs to those who believe in the beauty of their dreams.

    Thursday, April 16, 2015 6:55 AM
  • Hoooo.

    I thought you are just "saying" about OCR.

    I'm wrong.

    You have own answer already.

    It's amazing.

    Good for you.

    Friday, April 17, 2015 12:21 AM
  • Do you really think so ?

    In my opinion, they (MS) know the answer and proved it using the mini translator.

    I do not care about the detail/exact name of the technique(s) they used. Whatever it is, it is provided already and rock "stable".

    Regards


    Friday, April 17, 2015 12:24 AM
  • Hi Guys,

    We can interop with Office Word using VSTO. But you know. VSTO is based on Office Word and it's implement a part of programming foundation of Office Word.

    I check the Word Object Model and related technology. There is no APIs to achieve this goal. 

    In other words, not all functions in Word we can achieve via VSTO. 

    Regards,


    The future belongs to those who believe in the beauty of their dreams.

    Friday, April 17, 2015 1:08 AM
  • >In other words, not all functions in Word we can achieve via VSTO.

    I agree with that.

    .

    Regards

    Friday, April 17, 2015 10:05 AM