我正在编写使用Word.dll进行拼写检查的c#代码。我用下面的网站参考: http://www.codeproject.com/Articles/2469/SpellCheck-net-spell-checking-parsing-using-Cc中的拼写检查#
但我得到一个错误:“类型或命名空间名称‘字’找不到(是否缺少using指令或程序集引用?)”
,我使用的代码是:
SpellCheck word = new SpellCheck();
bool status = false;
string s = "youes";
Console.WriteLine("Checking for word : " + s);
// check to see if the word is not correct
// return the bool (true|false)
status = word.CheckSpelling(s);
if (status == false)
{
Console.WriteLine("This word is misspelled : " + s);
Console.WriteLine("Here are some suggestions");
Console.WriteLine("-------------------------");
foreach(string suggestion in word.GetSpellingSuggestions(s))
{
System.Console.WriteLine(suggestion);
}
}
else if (status == true)
{
Console.WriteLine("This word is correct : " + s);
}
我只是想知道我怎样才能使它发挥作用?
'下添加refernce到Micorsoft.Office.Interop.Word;'这是你的代码的顶部? – Bolu 2012-02-27 09:47:38