다음을 통해 공유


DocumentBase.CheckSpelling Method

Definition

Begins a spelling check for the document.

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);
member this.CheckSpelling : obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj -> unit
Public Sub CheckSpelling (Optional ByRef customDictionary As Object, Optional ByRef ignoreUppercase As Object, Optional ByRef alwaysSuggest As Object, Optional ByRef customDictionary2 As Object, Optional ByRef customDictionary3 As Object, Optional ByRef customDictionary4 As Object, Optional ByRef customDictionary5 As Object, Optional ByRef customDictionary6 As Object, Optional ByRef customDictionary7 As Object, Optional ByRef customDictionary8 As Object, Optional ByRef customDictionary9 As Object, Optional ByRef customDictionary10 As Object)

Parameters

customDictionary
Object

Either an expression that returns a Dictionary or the file name of the custom dictionary.

ignoreUppercase
Object

true if capitalization is ignored. If this argument is omitted, the current value of the IgnoreUppercase property is used.

alwaysSuggest
Object

true for Microsoft Office Word to always suggest alternative spellings. If this argument is omitted, the current value of the SuggestSpellingCorrections property is used.

customDictionary2
Object

Either an expression that returns a Dictionary or the file name of an additional custom dictionary. You can specify as many as nine additional dictionaries.

customDictionary3
Object

Either an expression that returns a Dictionary or the file name of an additional custom dictionary. You can specify as many as nine additional dictionaries.

customDictionary4
Object

Either an expression that returns a Dictionary or the file name of an additional custom dictionary. You can specify as many as nine additional dictionaries.

customDictionary5
Object

Either an expression that returns a Dictionary or the file name of an additional custom dictionary. You can specify as many as nine additional dictionaries.

customDictionary6
Object

Either an expression that returns a Dictionary or the file name of an additional custom dictionary. You can specify as many as nine additional dictionaries.

customDictionary7
Object

Either an expression that returns a Dictionary or the file name of an additional custom dictionary. You can specify as many as nine additional dictionaries.

customDictionary8
Object

Either an expression that returns a Dictionary or the file name of an additional custom dictionary. You can specify as many as nine additional dictionaries.

customDictionary9
Object

Either an expression that returns a Dictionary or the file name of an additional custom dictionary. You can specify as many as nine additional dictionaries.

customDictionary10
Object

Either an expression that returns a T:Microsoft.Office.Interop.Word.Dictionary or the file name of an additional custom dictionary. You can specify as many as nine additional dictionaries.

Examples

The following code example uses the CheckSpelling method to check the spelling of words in the document. While checking, Word ignores capitalization and suggests alternate spellings. To use this example, run it from the ThisDocument class in a document-level project.

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);
}
Private Sub DocumentCheckSpelling()

    Me.Range(0, 0).Text = "Allways check your speling. "
    Me.CheckSpelling(IgnoreUppercase:=True, AlwaysSuggest:=True)
End Sub

Remarks

If the document contains errors, this method displays the Spelling and Grammar dialog box, with the Check grammar check box cleared.

This method checks all available stories (such as headers, footers, and text boxes).

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Applies to