locked
Spelling check with non-english check, How to set in C#? RRS feed

  • Question

  • Hi everyone, I have a question about spelling check in word, if I use non-English language how to change the spelling check as corresponding language promote in C#? Screenshot as follows:    

    Thanks in advance.

    Wednesday, May 13, 2015 3:16 AM

Answers

  • Hi Floraaa,

    To check a string for spelling errors, we could use Application.CheckSpelling method.

    To get the words suggested as spelling replacements for a given word, we could use Application.GetSpellingSuggestions method.

    Simple sample (VBA):

    Sub Use_Default_Spelling()
    
    Dim wd As Range
    Dim Oldtxt As String
    Dim Newtxt As String
    Dim Sugg As SpellingSuggestions
    Dim AddSpace As String
    
        Application.ScreenUpdating = False
    
            
            Oldtxt = Selection.Range.Text
            
          
                If Not Application.CheckSpelling(Word:=Oldtxt, IgnoreUppercase:=True) Then
                    
                    Set Sugg = Application.GetSpellingSuggestions(Oldtxt)
                    
                    If Sugg.Count <> 0 Then
                         Newtxt = Application.GetSpellingSuggestions(Oldtxt).Item(1)
                                            Selection.Range.Text = Newtxt
                    End If
                End If
    
        Application.ScreenUpdating = True
    
    End Sub

    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, May 14, 2015 7:21 AM

All replies

  • The opinion of mine is that if the word can be found in the target dictionary, it delivers these results; otherwise, it looks in the English dictionary.  On conditon that you installed corresponding language pack in word.
    Wednesday, May 13, 2015 3:29 AM
  • Here is a solution,  you can take a look at this third party word library and download a free edition , then add dll files to your project. Then try to set the Locale ID Values as below:

    TextRange txtRange = para.AppendText("corrige según diccionario en inglés");
    txtRange.CharacterFormat.LocaleIdASCII = 10250;

    Wednesday, May 13, 2015 3:50 AM
  • Hi Floraaa,

    To check a string for spelling errors, we could use Application.CheckSpelling method.

    To get the words suggested as spelling replacements for a given word, we could use Application.GetSpellingSuggestions method.

    Simple sample (VBA):

    Sub Use_Default_Spelling()
    
    Dim wd As Range
    Dim Oldtxt As String
    Dim Newtxt As String
    Dim Sugg As SpellingSuggestions
    Dim AddSpace As String
    
        Application.ScreenUpdating = False
    
            
            Oldtxt = Selection.Range.Text
            
          
                If Not Application.CheckSpelling(Word:=Oldtxt, IgnoreUppercase:=True) Then
                    
                    Set Sugg = Application.GetSpellingSuggestions(Oldtxt)
                    
                    If Sugg.Count <> 0 Then
                         Newtxt = Application.GetSpellingSuggestions(Oldtxt).Item(1)
                                            Selection.Range.Text = Newtxt
                    End If
                End If
    
        Application.ScreenUpdating = True
    
    End Sub

    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, May 14, 2015 7:21 AM