We're trying to use Word's COM objects in order to programatically get the spelling and grammar errors in some sentences. We're using code that looks something like this:
foreach (Word.Range range in this.GrammaticalErrors)
{
MessageBox.Show(String.Format(
"Grammatical error: {0}",
range.Text));
}
foreach (Word.Range range in this.SpellingErrors)
{
MessageBox.Show(String.Format(
开发者_如何学Go "Spelling error: {0}",
range.Text));
}
This works fine for spelling: We print the words that are mistaken. But for grammar, the object seems to return the text of the entire sentence.
Any idea how to get the specific words with a grammar error?
精彩评论