If you're automating Word and checking text in Word, then the text you're checking has to be formatted with that language AND the required proofing tools must be installed. If you use the Document object or Range, this is what's going to happen.
If you're wanting to simply check any string, then you have to use the Application object. Again, the necessary proofing tools must be installed on the system. Unfortunately, CheckSpelling does not work as advertised. But a few years ago, someone figured out how to coerce GetSpellingSuggestions to do the job. For example (in VB-speak):
Sub CheckWithFrenchDic() Dim dic As String Dim s As String Dim sugList As SpellingSuggestions
dic = Languages(wdFrench).NameLocal s = "deuxieme" Set sugList = GetSpellingSuggestions(Word:=s, CustomDictionary:="Custom.dic", MainDictionary:=dic) If sugList.Count = 0 Then MsgBox "Word is correctly spelled" Else MsgBox "Word is incorrectly spelled" 'And you can do a foreach to get the individual suggestions End If End Sub
Word spellingchecker in french ..
dafan
If you're automating Word and checking text in Word, then the text you're checking has to be formatted with that language AND the required proofing tools must be installed. If you use the Document object or Range, this is what's going to happen.
If you're wanting to simply check any string, then you have to use the Application object. Again, the necessary proofing tools must be installed on the system. Unfortunately, CheckSpelling does not work as advertised. But a few years ago, someone figured out how to coerce GetSpellingSuggestions to do the job. For example (in VB-speak):
Sub CheckWithFrenchDic()
Dim dic As String
Dim s As String
Dim sugList As SpellingSuggestions
dic = Languages(wdFrench).NameLocal
s = "deuxieme"
Set sugList = GetSpellingSuggestions(Word:=s, CustomDictionary:="Custom.dic", MainDictionary:=dic)
If sugList.Count = 0 Then
MsgBox "Word is correctly spelled"
Else
MsgBox "Word is incorrectly spelled"
'And you can do a foreach to get the individual suggestions
End If
End Sub
Yeah, it's definitely weird. But it works...
chris_dk
_Document.Content.LanguageID = WdLanguageID.wdFrenchCanadian
Thanks all for your answers
weaselcoder
Hello, this question isn't VSTO / developer related. You'll have a better chance of getting an answer at the following site: http://www.microsoft.com/office/community/en-us/wizard.mspx lang=en&cr=US&cat=en-us-office-word&pt=617c4d62-4061-4107-8d46-2a22fc6fa202
Good luck!
norsd
I'm using word interop library to do spellcheck programmatically.
_Document.CheckSpelling(...);
and was wondering how i can set the spell checker to check the spelling in another language.
I'm sorry if i was unclear.
Thanks