开发者

How to get the indexes of a mistake in Word's GrammarErrors object

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜