Share via


DocumentBase.SpellingErrors 屬性

取得 ProofreadingErrors 集合,表示在文件中識別為拼字錯誤的文字。

命名空間:  Microsoft.Office.Tools.Word
組件:  Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)

語法

'宣告
Public ReadOnly Property SpellingErrors As ProofreadingErrors
public ProofreadingErrors SpellingErrors { get; }

屬性值

型別:Microsoft.Office.Interop.Word.ProofreadingErrors
ProofreadingErrors 集合,表示在文件中識別為拼字錯誤的文字。

範例

下列程式碼範例會在文件中插入拼寫錯誤的文字,然後檢查文件中的所有文字是否具有拼字錯誤。 若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

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 
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);
    }
}

.NET Framework 安全性

請參閱

參考

DocumentBase 類別

Microsoft.Office.Tools.Word 命名空間