0

我正在尝试使用 c# api 以不同语言使用 MS Office 进行拼写检查。我已经安装了所有相关的语言包。例如,如果我输入德语拼写错误的单词“buxs”,我会得到英文建议:bus、buss、buds、boxes、bugs、bums、buys、box's、buns、burs。但我期待这样的建议:Bus、büxt、bis、büxe、Bugs、Buhs。

我的代码在下面......我做错了什么?

wordApp = new Application();
wordApp.Visible = true;
WdLanguageID language = WdLanguageID.wdGerman;

wordDocument = wordApp.Documents.Add(ref missing, ref missing, ref missing, ref missing);
wordDocument.Content.LanguageID = language;

// This is mis-spelled. 
string misSpelledWord = "buxs";

// this returns english suggestions...
SpellingSuggestions theSuggestions = wordApp.GetSpellingSuggestions( misSpelledWord, ref missing, ref missing, ref missing, ref suggestionMode, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
4

1 回答 1

0

我已经对GetSpellingSuggestionsinWord Application和 in做了一些测试,Range你描述的行为似乎是正常的。我计算机上的语言是西班牙语,当我使用您的代码(使用WdLanguageID.wdSpanishand "buxs")时,我会得到您推荐的建议(当我转到英语时,我会得到相同的建议)。另一方面,当我换成德语时,我什么也得不到。我还用西班牙语(“kasa”或“part”)测试了“明显暗示”的单词,结果很好。

我的结论是,如果可以在目标词典中找到该词,它就会提供这些结果;否则,它会在英语词典中查找。显然,德语词典中不包含“buxs”。

于 2013-08-20T21:42:37.560 回答