SpellCheck on Code Behinde

2 posts, 0 answers
  1. Sue Hills
    Sue Hills avatar
    2 posts
    Member since:
    May 2007

    Posted 13 Jun 2013 Link to this post

    I would like to know if it is possible use spell check on word documents and take back a list of erroneous words.
    I need to use these words one by one and replace them with a selected correct word on dictionary from outside of the silverlight control.
    So I canot use the showSpellCheckDialog.....

    For example: The user click on a button on html and the javascript will call a function on silverlight to bring the first incorrect word and the dictionay options for replacement. So when user select the correct word, the silverlight will do the replacement on many word documents
    that are on a list.
  2. Andrew
    Andrew avatar
    140 posts

    Posted 18 Jun 2013 Link to this post

    Hello Sue,

    Here is some code that will allow you to get the next error word from a given position. Once you get it the code shows how to retrieve all suggestions. To use this approach you need to load the document in RadRichTextBox first.
    DocumentSpellChecker documentSpellChecker = this.radRichTextBox.SpellChecker as DocumentSpellChecker;
                DocumentProofingManager documentProofingManager =
                    new DocumentProofingManager(this.radRichTextBox.Document, documentSpellChecker, this.radRichTextBox.IgnoredWords);
                //here you can pass any document position you want. We pass the document position for convenience
                WordInfo wordInfo = documentProofingManager.GetNextErrorWord(this.radRichTextBox.Document.CaretPosition);
                if (wordInfo != null)
                    string nextErrorWord = wordInfo.Word;
                    IEnumerable<string> suggestions = documentSpellChecker.GetSuggestions(nextErrorWord);


    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top