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

spell check

7 Answers 114 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
cool
Top achievements
Rank 1
cool asked on 12 Nov 2010, 07:35 AM
hi,

How to do spell check ?.

Thanks in advance

7 Answers, 1 is accepted

Sort by
0
Mike
Telerik team
answered on 12 Nov 2010, 01:40 PM
Hi Cool,

If you refer to spell-check functionality of RadRichTextBox that we introduced in Q3, it actually works pretty straight-forward. You need to add RadRichTextBox and RadRichTextBoxRibbonUI controls on your Silverlight page which are located in the following assemblies:
Telerik.Windows.Controls
Telerik.Windows.Documents
Telerik.Windows.Controls.Input
Telerik.Windows.Controls.Navigation
Telerik.Windows.Controls.RibbonBar
Telerik.Windows.Controls.RichTextBoxUI

Then you should add a reference to the assembly containing the English dictionary:
Telerik.Windows.Documents.Proofing.Dictionaries.En-US
This is a new assembly added in Q3. RadRichTextBox will load the dictionary using MEF so you should not worry about any binding details.

The spell-checking feature is enabled by default. Thus RadRichTextBox will underline in red all errors found in the document. This feature can be toggled using the property:
RadRichTextBox.IsSpellCheckingEnalbed

Note:  If you already have RadRichTextBoxRibbonUI added to your page and you do not want to reset it, you can add only the proofing tools with the designer context menu:



Result should look like in the demo app:
http://demos.telerik.com/silverlight/#RichTextBox/MSWord

On the ribbon UI you have two buttons concerning spell-checking:


Enable Spell Check - this toggles the functionality using the same way as the property mentioned.
Find Next Error - this will search the document for spelling errors and position the context menu on the error to allow you correct the error, add it to the custom dictionary or ignore it:



This functionality can also be invoked through RadRichTextBox.OpenContextMenuOnNextSpellingError() method.

Let us know whether this helps.

Kind regards,
Mike
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Eduardo Rojas
Top achievements
Rank 1
answered on 26 Nov 2010, 07:27 PM
Hello,
But if I want English to Spanish, how do I do?.

Thanks

0
Iva Toteva
Telerik team
answered on 30 Nov 2010, 10:39 AM
Hi Eduardo Rojas,

Currently SpellChecker works with RadDictionary, which can be created from .TDF files (the format used in Telerik ASP.NET RadSpell). You can use the es-ES dictionary from this forum post or create your own, following the steps, described here.
Then you need to create an instance of DocumentSpellChecker using that RadDictionary and assign your RadRichTextBox's SpellChecker property to it as described in our help section.
Let us know if you need further help.

Regards,
Iva
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Eduardo Rojas
Top achievements
Rank 1
answered on 30 Nov 2010, 04:02 PM
hi, thanks for replying, but where I put the dictionary file in my project, and how to call it from the page?
On this page

http://www.telerik.com/help/silverlight/radrichtextbox-features-spellcheck.html # Dictionaries

says:

Private Sub CreateCustomDictionary ()
 
Dim dictionary As New RadIsolatedStorageCustomDictionary (IsolatedStorageScope.Site, "CustomDictionary.txt)
 
Dim As New DocumentSpellChecker spellchecker (dictionary)
 
Me.radRichTextBox.SpellChecker = spellchecker
End Sub


and also:

LoadDictionary Private Sub (ByVal tdfFileStream As Stream)
 
Dim dictionary As New RadDictionary ()
 
CType (Me.radRichTextBox.SpellChecker, DocumentSpellChecker). AddDictionary (dictionary, New CultureInfo ("de-DE");}

In my project I put the language in this last example ("es-ES") but does not identify the tdf file, and I want to know if your example (Me.radRichTextBox ... is the bone RadRichTextBoxRibbonUI1 the edit.

thanks
0
Iva Toteva
Telerik team
answered on 01 Dec 2010, 02:24 PM
Hi Eduardo Rojas,

The first snippet you posted is for creating IsolatedStorage dictionary.
The second snippet, however, has a missing line - the one which actually loads the stream into the instance of RadDictionary.
The code you need is:

Dim tdfFileStream As Stream = Application.GetResourceStream(New Uri("es-ES.tdf", UriKind.Relative)).Stream
Dim dictionary As New RadDictionary()
dictionary.Load(tdfFileStream)
Thread.CurrentThread.CurrentCulture = New CultureInfo("es-ES")
DirectCast(Me.radRichTextBox.SpellChecker, DocumentSpellChecker).AddDictionary(dictionary, New CultureInfo("es-ES"))

if "es-ES.tdf" is located directly in your Silverlight application. 

There is a sample project (using an Italian dictionary and in C#) in this forum post. Note that currently we have an issue related to spelling errors highlighting, when another culture is use in the main Thread. This problem will be resolved with next internal build, thus for now you would need to register the new dictionary with the InvarianCulture, as specified in the demo. Look through it and let us know if you have any other questions.

Regards,
Iva
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Kotte
Top achievements
Rank 1
answered on 12 Oct 2011, 03:52 PM
Hi Iva,
I am trying to add a custom dictionary to Rad Spell Check..

I created Test.txt file with few words and added to the project and loading to IsolatedStorage

IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();          
isoStore.CreateDirectory("SpellCheck");
IsolatedStorageFileStream isoStream1 =  new IsolatedStorageFileStream("Test.txt", FileMode.Create, isoStore);
isoStream1.Close();


Creating the Custom Dictionary..
RadIsolatedStorageCustomDictionary dictionary = new RadIsolatedStorageCustomDictionary(IsolatedStorageScope.Application, "Test.txt");
DocumentSpellChecker spellchecker = new DocumentSpellChecker(dictionary);
this._richTextBox.SpellChecker = spellchecker;

Adding Dictionary
 Stream tdfFileStream = Application.GetResourceStream(new Uri("/MC.Client.Controls;component/Resources/en-US.tdf", UriKind.RelativeOrAbsolute)).Stream;
 RadDictionary dictionary1 = new RadDictionary();
 dictionary1.Load(tdfFileStream);
 ((DocumentSpellChecker)this._richTextBox.SpellChecker).AddDictionary(dictionary, CultureInfo.CurrentCulture);


its still showing the default dictionary and I did not find the words from Test.txt file.
Am I missing any thing.
Can you please post a sample working project which loads custom dictionary file like (ex: CustomDictionary.txt )

Thanks.
Kotte.
0
Kotte
Top achievements
Rank 1
answered on 13 Oct 2011, 04:08 PM
Hi,

I am able to fix the issue.Its working fine now.

Thanks,
Kotte
Tags
General Discussions
Asked by
cool
Top achievements
Rank 1
Answers by
Mike
Telerik team
Eduardo Rojas
Top achievements
Rank 1
Iva Toteva
Telerik team
Kotte
Top achievements
Rank 1
Share this question
or