Share via


DocumentBase.CheckSpelling 方法

開始文件的拼字檢查。

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

語法

'宣告
Public Sub CheckSpelling ( _
    ByRef customDictionary As Object, _
    ByRef ignoreUppercase As Object, _
    ByRef alwaysSuggest As Object, _
    ByRef customDictionary2 As Object, _
    ByRef customDictionary3 As Object, _
    ByRef customDictionary4 As Object, _
    ByRef customDictionary5 As Object, _
    ByRef customDictionary6 As Object, _
    ByRef customDictionary7 As Object, _
    ByRef customDictionary8 As Object, _
    ByRef customDictionary9 As Object, _
    ByRef customDictionary10 As Object _
)
public void CheckSpelling(
    ref Object customDictionary,
    ref Object ignoreUppercase,
    ref Object alwaysSuggest,
    ref Object customDictionary2,
    ref Object customDictionary3,
    ref Object customDictionary4,
    ref Object customDictionary5,
    ref Object customDictionary6,
    ref Object customDictionary7,
    ref Object customDictionary8,
    ref Object customDictionary9,
    ref Object customDictionary10
)

參數

  • customDictionary
    型別:System.Object%
    可能是傳回 Dictionary 的陳述式,或自訂字典的檔案名稱。
  • ignoreUppercase
    型別:System.Object%
    如果忽略大小寫則為 true。如果省略這個引數,就會使用 IgnoreUppercase 屬性目前的值。
  • alwaysSuggest
    型別:System.Object%
    若要 Microsoft Office Word 永遠建議替代的拼字,則為 true。如果省略這個引數,就會使用 SuggestSpellingCorrections 屬性的目前值。
  • customDictionary2
    型別:System.Object%
    可能是傳回 Dictionary 的運算式,或是其他自訂字典的檔案名稱。您最多可以指定九部其他字典。
  • customDictionary3
    型別:System.Object%
    可能是傳回 Dictionary 的運算式,或是其他自訂字典的檔案名稱。您最多可以指定九部其他字典。
  • customDictionary4
    型別:System.Object%
    可能是傳回 Dictionary 的運算式,或是其他自訂字典的檔案名稱。您最多可以指定九部其他字典。
  • customDictionary5
    型別:System.Object%
    可能是傳回 Dictionary 的運算式,或是其他自訂字典的檔案名稱。您最多可以指定九部其他字典。
  • customDictionary6
    型別:System.Object%
    可能是傳回 Dictionary 的運算式,或是其他自訂字典的檔案名稱。您最多可以指定九部其他字典。
  • customDictionary7
    型別:System.Object%
    可能是傳回 Dictionary 的運算式,或是其他自訂字典的檔案名稱。您最多可以指定九部其他字典。
  • customDictionary8
    型別:System.Object%
    可能是傳回 Dictionary 的運算式,或是其他自訂字典的檔案名稱。您最多可以指定九部其他字典。
  • customDictionary9
    型別:System.Object%
    可能是傳回 Dictionary 的運算式,或是其他自訂字典的檔案名稱。您最多可以指定九部其他字典。
  • customDictionary10
    型別:System.Object%
    可能是傳回 T:Microsoft.Office.Interop.Word.Dictionary 的運算式,或是其他自訂字典的檔案名稱。您最多可以指定九部其他字典。

備註

如果文件包含錯誤,這個方法會顯示 [拼字及文法檢查] 對話方塊,並清除 [檢查文法] 核取方塊。

此方法會檢查所有可用的大綱 (例如,頁首、頁尾和文字方塊)。

選擇性參數

如需選擇性參數的詳細資訊,請參閱Office 方案中的選擇性參數

範例

下列程式碼範例會使用 CheckSpelling 方法,檢查文件中文字的拼字是否正確。 檢查進行時,Word 會忽略大小寫並建議替代拼字。 若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

Private Sub DocumentCheckSpelling()

    Me.Range(0, 0).Text = "Allways check your speling. "
    Me.CheckSpelling(IgnoreUppercase:=True, AlwaysSuggest:=True)
End Sub
private void DocumentCheckSpelling()
{
    object ignoreUppercase = true;
    object alwaysSuggest = true;

    // Add a sentence with mispellings to the document.
    object start = 0;
    object end = 0;
    string newText = "Allways check your speling. ";
    Word.Range range1 = this.Range(ref start, ref end);
    range1.Text = newText;

    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 命名空間