DocumentBase.SpellingErrors 属性

定义

获取一个 ProofreadingErrors 集合,该集合表示文档中标识为拼写错误的单词。

public Microsoft.Office.Interop.Word.ProofreadingErrors SpellingErrors { get; }

属性值

ProofreadingErrors

一个集合 ProofreadingErrors,表示文档中标识为拼写错误的单词。

示例

下面的代码示例在文档中插入拼写错误的单词,然后检查文档中所有单词的拼写。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。

private void DocumentSpellingErrors()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.Text = "This bookmark contains a spellling error.";

    object IgnoreUppercase = true;
    object AlwaysSuggest = true;
    if (this.SpellingErrors.Count > 0)
    {
        this.CheckSpelling(ref missing, ref IgnoreUppercase, ref AlwaysSuggest,
            ref missing, ref missing, ref missing, ref missing,
            ref missing, ref missing, ref missing, ref missing,
            ref missing);
    }
}
Private Sub DocumentSpellingErrors()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Text = "This bookmark contains a spellling error."

    Dim IgnoreUppercase As Object = True
    Dim AlwaysSuggest As Object = True
    If Me.SpellingErrors.Count > 0 Then
        Me.CheckSpelling(, IgnoreUppercase, AlwaysSuggest)
    End If
End Sub 

适用于