none
Custom Grammar Dictionary RRS feed

  • Question

  • I need to find a way to have Word underline certain words (like it does for a spell check) which are not supposed to be used in certain contexts without actually removing them from the dictionary. Is there a way to have certain words appear in a spell check without actually removing them from the dictionary? And it would be even better if I could have the words underlined, then suggest a replacement based on my own custom criteria.

    To give an example, I'm trying to avoid saying any absolutes. For example:

    I want the word "guarantee" to be underlined in this context:

    "I guarantee all of my work is accurate"

    and if possible I would like the user to right-click the word gaurantee and see a suggestion to replace the word with "believe"

    So it would read

    "I believe all of my work is accurate"

    Any Ideas?

    Thanks, Andy

    Friday, July 27, 2012 3:12 PM

Answers

  • Unfortunately controlling the grammar and spelling checks, adding/removing red underlines,  is one of the few things not achievable through the Word object model.

    Probably your only recourse it to use the CSAPI, which is only supplied after submitting a written request. Someone wrote in another thread, about 10 months ago, that this was a long process for them, and even once you get it it's likely to be less easy to use than the Word object model.

    Edit: I think this is the thread I'm remembering. More like 18 months ago...how time flies.
    Friday, July 27, 2012 7:35 PM
  • Hi Andy

    I agree with Joseph.

    The only workaround I could suggest would be to have a "Find/Replace" that would look for the given phrase. You could have it run on Save As or Document Close, perhaps. The code could use some special formatting, or show a dialog box with a prompt to the user, or...


    Cindy Meister, VSTO/Word MVP

    Saturday, July 28, 2012 1:32 PM
    Moderator

All replies

  • Is there any way to make formatting appear (such as an underline) appear in a document, but then not appear when printing the document? I'm looking for something similar to what spell check does with the little underlines.

    Any Ideas?

    Thanks, Andy

    Friday, July 27, 2012 5:11 PM
  • Unfortunately controlling the grammar and spelling checks, adding/removing red underlines,  is one of the few things not achievable through the Word object model.

    Probably your only recourse it to use the CSAPI, which is only supplied after submitting a written request. Someone wrote in another thread, about 10 months ago, that this was a long process for them, and even once you get it it's likely to be less easy to use than the Word object model.

    Edit: I think this is the thread I'm remembering. More like 18 months ago...how time flies.
    Friday, July 27, 2012 7:35 PM
  • You could apply a style that adds the formatting and then create a couple of macros which intercept the print commands so that the formatting is cleared (from the style) before printing. Which specific formatting do you have in mind?
    Stefan Blom, Microsoft Word MVP
    Friday, July 27, 2012 7:46 PM
  • I would like to avoid using a macro if at all possible. What I'm doing is basically using an autocorrect to format certain words I want to stand out to whoever is writing the document (Sort of a "Hey, did you mean to type this word" sort of thing. However, I don't want these formats to be visible when the documents are issued to the client.
    Friday, July 27, 2012 9:06 PM
  • I would like to avoid using a macro if at all possible. What I'm doing is basically using an autocorrect to format certain words I want to stand out to whoever is writing the document (Sort of a "Hey, did you mean to type this word" sort of thing. However, I don't want these formats to be visible when the documents are issued to the client.


    You certainly don't have to use a macro. Find and replace can be used to quickly delete formatting (search for the format and replace with the style "Default Paragraph Font").
     
    Again, please explain which formatting you are referring to.

    Stefan Blom, Microsoft Word MVP
    Friday, July 27, 2012 9:32 PM
  • It doesn't really matter what formatting. It could be a highlight or an underline, or both
    Friday, July 27, 2012 9:43 PM
  • It doesn't really matter what formatting. It could be a highlight or an underline, or both


    In principle you're right, but it does matter in the sense that if the same formatting is also used for other purposes in the same document, Find and Replace wouldn't be able to tell them apart.

    Stefan Blom, Microsoft Word MVP
    Friday, July 27, 2012 9:53 PM
  • Hi Andy

    I agree with Joseph.

    The only workaround I could suggest would be to have a "Find/Replace" that would look for the given phrase. You could have it run on Save As or Document Close, perhaps. The code could use some special formatting, or show a dialog box with a prompt to the user, or...


    Cindy Meister, VSTO/Word MVP

    Saturday, July 28, 2012 1:32 PM
    Moderator
  • Hi Andy

    <<I would like to avoid using a macro if at all possible. What I'm doing is basically using an autocorrect to format certain words I want to stand out to whoever is writing the document (Sort of a "Hey, did you mean to type this word" sort of thing. However, I don't want these formats to be visible when the documents are issued to the client.>>

    If you don't want to use macro code, then I recommend you ask questions in the set of forums that targets end-user (non-programming) questions on Answers:
    http://answers.microsoft.com/en-us/office/forum/word

    You'll find many more people there who can help you than those who frequent the MSDN forums that specifically target programming issues :-)

    Unfortunately, we can't move messages from MSDN to Answers...


    Cindy Meister, VSTO/Word MVP

    Saturday, July 28, 2012 1:37 PM
    Moderator