I wrote a spell checker function, however I could not adjust its language.
Although it has an adjustment part : object objLanguage = Word.WdLanguageID.wdEnglishUS; , it is not working.
I live in Turkey and it works Turkish.
Can you help me ? Thanks a lot.
Although it has an adjustment part : object objLanguage = Word.WdLanguageID.wdEnglishUS; , it is not working.
I live in Turkey and it works Turkish.
Can you help me ? Thanks a lot.
Code:
public string[] Suggest2(string word)
{
object nothing = Missing.Value;
object objLanguage = Word.WdLanguageID.wdEnglishUS;
//ask MS Word to spell check the given word
bool spelledright = this.application.CheckSpelling(
word,
ref nothing,
ref nothing,
ref (object)objLanguage,
ref nothing,
ref nothing,
ref nothing,
ref nothing,
ref nothing,
ref nothing,
ref nothing,
ref nothing,
ref nothing
);
if (spelledright) return null;
//if word is spelled wrong, ask MS Word to suggest
//other similar words.
ArrayList words = new ArrayList();
SpellingSuggestions suggestions =
this.application.GetSpellingSuggestions(
word,
ref nothing,
ref nothing,
ref (object)objLanguage,
ref nothing,
ref nothing,
ref nothing,
ref nothing,
ref nothing,
ref nothing,
ref nothing,
ref nothing,
ref nothing,
ref nothing
);
//add the suggestions to an ArrayList temporarily
foreach (SpellingSuggestion suggestion in suggestions)
words.Add(suggestion.Name);
suggestions = null;
//return the suggestions as a string array
return (string[])words.ToArray(typeof(string));
}