none
Custom spelling on Word 2010,2013,2016 with a VSTO add-in and C#, is it possible? RRS feed

  • Question

  • Hi,there.

    We have developed MS Word plugin which does spelling and grammar checker in the document.

    I have an application-level add-in that, amongst other functionality, gives the user the option to use our own set of rules when checking spelling and grammar instead of the dictionary currently selected in Word. A user will be able to configure the application to use our own checking.

    If it's possible, we'd like to "mark" the errors the same way Word does it, with a red wavy underscore for spelling errors, green for grammatical errors, and so on. Is that possible? I've seen that there is a SpellingErrors property in the Range class but I imagine that uses Word's own spellchecking. Is there a way for us to substitute it with our own, or, even better, a way to just "underscore with a wavy red line" a Range?

    Of course, there's no way both Word's checking and our own will be active at the same time, we make sure of it.
    Thursday, March 8, 2018 1:27 AM

Answers

  • Hi nrisnh,

    If you have developed your own logic to find the spelling errors then you may try to use the Font.Underline Property to underline the spelling mistakes.

     private void button1_Click(object sender, RibbonControlEventArgs e)
            {
                Globals.ThisAddIn.Application.Selection.Font.Underline = Microsoft.Office.Interop.Word.WdUnderline.wdUnderlineWavy;
                Globals.ThisAddIn.Application.Selection.Font.UnderlineColor = Microsoft.Office.Interop.Word.WdColor.wdColorDarkRed;
            }

    Output:

    Reference:

    Font.Underline Property (Word)

    WdUnderline Enumeration (Word)

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by nrisnh Monday, March 12, 2018 12:07 AM
    Friday, March 9, 2018 5:44 AM
    Moderator
  • Hi nrisnh,

    On this forum, We only provide support for Office.Word.Interop Library.

    So we are not aware about any other third party library that can fulfil your requirement.

    But you can try to develop a logic based on custom conditions that user will not be able to remove those Red lines directly from the ribbon and He can follow the steps to correct the spelling mistakes or add that spelling in to your dictionary to remove the red line as per your logic.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by nrisnh Monday, March 12, 2018 12:52 AM
    Monday, March 12, 2018 12:26 AM
    Moderator

All replies

  • Hi nrisnh,

    If you have developed your own logic to find the spelling errors then you may try to use the Font.Underline Property to underline the spelling mistakes.

     private void button1_Click(object sender, RibbonControlEventArgs e)
            {
                Globals.ThisAddIn.Application.Selection.Font.Underline = Microsoft.Office.Interop.Word.WdUnderline.wdUnderlineWavy;
                Globals.ThisAddIn.Application.Selection.Font.UnderlineColor = Microsoft.Office.Interop.Word.WdColor.wdColorDarkRed;
            }

    Output:

    Reference:

    Font.Underline Property (Word)

    WdUnderline Enumeration (Word)

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by nrisnh Monday, March 12, 2018 12:07 AM
    Friday, March 9, 2018 5:44 AM
    Moderator
  • thanks for the information. 

    But this line is cleared by the user. 

    Isn't it possible for third-parties to use Word's grammar check marking (wavy lines)?

    • Edited by nrisnh Monday, March 12, 2018 12:11 AM
    Monday, March 12, 2018 12:07 AM
  • Hi nrisnh,

    On this forum, We only provide support for Office.Word.Interop Library.

    So we are not aware about any other third party library that can fulfil your requirement.

    But you can try to develop a logic based on custom conditions that user will not be able to remove those Red lines directly from the ribbon and He can follow the steps to correct the spelling mistakes or add that spelling in to your dictionary to remove the red line as per your logic.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by nrisnh Monday, March 12, 2018 12:52 AM
    Monday, March 12, 2018 12:26 AM
    Moderator