Export (0) Print
Expand All
Expand Minimize

How to: Check Spelling in Documents

NoteNote

Some code examples in this topic use the this or Me keyword or the Globals class in a way that is specific to document-level customizations, or they rely on features of document-level customizations such as host controls. These examples can be compiled only if you have the required applications installed. For more information, see Features Available by Product Combination.

The CheckSpelling method returns a Boolean value indicating whether the supplied parameter is spelled correctly. You can optionally supply the name of a custom dictionary and a Boolean value indicating whether you want to ignore case. You can also optionally supply the name of up to nine custom dictionaries. You can display the results in a message box.

To check spelling and display results in a message box

  • Call the CheckSpelling method and pass it a range of text to check for spelling errors.

    string result = "Spelled incorrectly.";
    
    object startLocation = this.Content.Start;
    object endLocation = this.Content.End;
    
    bool spellCheck = this.Application.CheckSpelling(
        this.Range(ref startLocation, ref endLocation).Text,
        ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
        ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
    
    if (spellCheck == true)
    {
        result = "Spelled correctly.";
    }
    
    MessageBox.Show(result);
    
    

See Also

Community Additions

ADD
Show:
© 2014 Microsoft