Hello,
I'm trying to get the English dictionary object MS Word uses and I want to use it to spell check. Here is the code I'm writing to do that:
Here's the CheckSpelling function:
The call to app.CheckSpelling(...) in my CheckSpelling function throws a COMException whose details say "Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)". Can anyone see what I might be doing wrong?
I'm trying to get the English dictionary object MS Word uses and I want to use it to spell check. Here is the code I'm writing to do that:
Code:
Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Dictionary EngDict = null;
foreach (Microsoft.Office.Interop.Word.Language l in app.Languages)
{
if (l.Name.Contains("English (US)"))
{
EngDict = l.ActiveSpellingDictionary;
break;
}
}
EngDict.LanguageID = Microsoft.Office.Interop.Word.WdLanguageID.wdEnglishUS;
object EngDictObj = EngDict;
bool b = CheckSpelling("hello", EngDictObj);
Here's the CheckSpelling function:
Code:
private bool CheckSpelling(string word, object dict)
{
Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
object O = null;
return app.CheckSpelling(word, ref O, ref O, ref dict, ref O, ref O, ref O, ref O, ref O, ref O, ref O, ref O, ref O);
}
The call to app.CheckSpelling(...) in my CheckSpelling function throws a COMException whose details say "Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)". Can anyone see what I might be doing wrong?