Partilhar via


DocumentBase.CheckSpelling Method

Begins a spelling check for the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
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
)

Parameters

  • customDictionary
    Type: System.Object%

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

  • ignoreUppercase
    Type: System.Object%

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

  • alwaysSuggest
    Type: System.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
    Type: System.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
    Type: System.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
    Type: System.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
    Type: System.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
    Type: System.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
    Type: System.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
    Type: System.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
    Type: System.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
    Type: System.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.

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.

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 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 Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace