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.

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));

}

The dictionaries are installed in Office 2003 - Word and in the project (Visual Studio) "Add Reference" is done for the Microsoft Word 11.0 Object Library. However, when I send some words to the function it checks for Turkish spelling and suggests Turkish words(I live in Turkey). I want it to check and suggest in English. Could you help me, please. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.