This is a migrated thread and some comments may be shown as answers.

Any way to list the misspelled words?

1 Answer 50 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
danparker276
Top achievements
Rank 2
danparker276 asked on 05 Mar 2012, 10:30 PM
Is there anything on the document that will list the misspelled words.  I'm basically going to give a warning message, saying you have these misspelled words, do you wish to continue.  I'm doing it like below which works fine, but I'm just wondering if there is already a list in the document.

UPDATE:  This code below fails on words that are considered names like 'Microsoft' with an uppercase M.  It won't find it in the dictionary, but it doesn't show a red under because the M is capitalized.  Any way I can ignore those?  Or would the rule be just ignore everything that starts with a capital.

string a = new TxtFormatProvider().Export(rrtbDescription.Document);
string[] allwords = a.Split(' ');
List<string> misspelled = new List<string>();
foreach (var z in allwords)
{
    if (this.rrtbDescription.SpellChecker.CheckWordIsCorrect(z) == false)
    {
        misspelled.Add(z);
    }
}

1 Answer, 1 is accepted

Sort by
0
Accepted
Boby
Telerik team
answered on 09 Mar 2012, 09:38 AM
Hello Dan,
You can use the DocumentProofingManager instead:
RadDocument document = (RadDocument)this.radRichTextBox.Document.CreateDeepCopy();
 
DocumentProofingManager proofingManager = new DocumentProofingManager(document, this.radRichTextBox.SpellChecker, this.radRichTextBox.IgnoredWords);
var incorrectWordsList = proofingManager.GetIncorrectWordList();
Creating a copy of the document is needed because otherwise RadRichTextBox spell checker marks the spans as spellchecked and proofing manager skips them.

Don't hesitate to contact us if you have other questions.


All the best,
Boby
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
RichTextBox
Asked by
danparker276
Top achievements
Rank 2
Answers by
Boby
Telerik team
Share this question
or