Hi Team!
Is their a way on how to used the SpellCheckUppercaseWords and SpellCheckWordsWithNumbers property under the namespace Telerik.WinForms.Documents.Proofing while I am using Telerik.WinControls.RichTextBox.Proofing for loading the spell check custom library. As i tried WinControls.RichTextBox.Proofing does not contains a member of DocumentSpellChecker.Settings so therefore I cannot use this way of using the property DocumentSpellChecker.Settings.SpellCheckUppercaseWords = True for allowing uppercase spell check. See below part of my code.
//Setting up spell check.
Friend Shared SpellCheckCulture As CultureInfo = CultureInfo.GetCultureInfo("en-GB")
Dim textBoxControlSpellChecker As IControlSpellChecker = Me.RadSpellCheck.GetControlSpellChecker(GetType(TextBox))
Dim documentSpellChecker As DocumentSpellChecker = TryCast(textBoxControlSpellChecker.SpellChecker, DocumentSpellChecker)
documentSpellChecker.Settings.SpellCheckUppercaseWords = True //This part will got an error if I import Telerik.WinControls.RichTextBox.Proofing
documentSpellChecker.AddDictionary(New SpellCheckDictionary(), SpellCheckCulture)
documentSpellChecker.SpellCheckingCulture = SpellCheckCulture
//Loading of Custom Library using Telerik.WinControls.RichTextBox.Proofing
Public Class SpellCheckDictionary
Inherits WordDictionary
Protected Overrides Sub EnsureDictionaryLoadedOverride()
Try
Using ms As MemoryStream = New MemoryStream(File.ReadAllBytes("en-GB.tdf"))
Me.Load(ms)
End Using
Catch ex As Exception
Glenfield.Common.HandleError(ex)
End Try
End Sub
End Class
6 Answers, 1 is accepted
Thank you for writing.
Please note that the RadRichTextBox control is obsolete since our Q3 2014 release. The required settings is only available for the RadRichTextEditor and it is located in the Telerik.WinForms.Documents.Proofing namespace. Please check the following documentation article explaining how the SpellCheck functionality works: RadRichTextEditor | SpellCheck
I created a simple example demonstrating how your task can be achieved using RadRichTextEditor:
Private
Sub
SetDictionaryPref(radRichTextEditor
As
RadRichTextEditor)
Dim
spellCheckCulture
As
CultureInfo = CultureInfo.GetCultureInfo(
"en-GB"
)
Dim
dictionary =
Me
.GetDictionary()
If
dictionary IsNot
Nothing
Then
CType
(radRichTextEditor.SpellChecker, DocumentSpellChecker).AddDictionary(dictionary, spellCheckCulture)
Dim
documentSpellChecker
As
DocumentSpellChecker = TryCast(radRichTextEditor.SpellChecker, DocumentSpellChecker)
documentSpellChecker.Settings.SpellCheckUppercaseWords =
True
End
If
End
Sub
Private
Function
GetDictionary()
As
RadDictionary
Dim
dictionary
As
New
RadDictionary
Try
Using ms
As
MemoryStream =
New
MemoryStream(File.ReadAllBytes(
"en-GB.tdf"
))
dictionary.Load(ms)
End
Using
Return
dictionary
Catch
ex
As
Exception
Return
Nothing
End
Try
End
Function
I hope this helps. Should you have further questions please do not hesitate to write back.
Regards,
Hristo Merdjanov
Telerik
Hi Hristo,
Thank you for the prompt response.
In relation with the above concern, before I used MS multi line TextBox, but to work with the above suggestions i change to RadRichTextbox but i found differences in font size, even though the font settings are all the same as MS TextBox. How do I work this out in RadRichTextBox, is there any other settings or property do i have to set.
​
Thank you for writing back.
I did not observe issues with the font size of the content in RadRichTextBox. As I mentioned earlier the control is obsolete and is not being further developed.
If possible, I suggest you to switch to the more advanced RadRichTextEditor. In case you insist on staying with RadRichTextBox here is an article explaining the spellchecking feature: http://www.telerik.com/help/winforms/richtextbox-features-spellcheck.html
I hope this helps. Should you have further questions please do not hesitate to write back.
Regards,
Hristo Merdjanov
Telerik
Hi Hristo!, I'm trying to use SpellChecker with RadTextBox in mode "word by word", it works ok except when RadTextBox control has the property CharacterCasing set to "Upper". My DocumentSpellChecker object hasn't a property named "Settings" to set the property "SpellCheckUppercaseWords", Code example: spcValor is RadSpellChecker control, txt_valor is RadTextBox control:
Thank you very much.
spcValor.AutoSpellCheckControl = txt_valor
setearDiccionario(spcValor)
...
Public
Shared
Sub
setearDiccionario(
ByRef
ao_spcControl
As
Telerik.WinControls.UI.RadSpellChecker)
Dim
lo_textBoxControlSpellChecker
As
Telerik.WinControls.UI.IControlSpellChecker = ao_spcControl.GetControlSpellChecker(
GetType
(Telerik.WinControls.UI.RadTextBox))
Dim
lo_documentSpellChecker
As
Telerik.WinControls.SpellChecker.Proofing.DocumentSpellChecker = TryCast(lo_textBoxControlSpellChecker.SpellChecker,Telerik.WinControls.SpellChecker.Proofing.DocumentSpelChecker)
lo_documentSpellChecker.AddDictionary(
New
MySpanishDictionary(), CulturaEspanol)
End
Sub
RadRichTextEditor has its own spellchecking functionality which is not related to the functionality provided by RadSpellChecker. That is why the SpellCheckUppercaseWords is missing for RadSpellChecker. However, if you need to enable the upper casing for your specific case, please refer to the following code snippet how to do it:
Friend
Shared
CulturaEspanol
As
CultureInfo = CultureInfo.GetCultureInfo(
"es-ES"
)
Sub
New
()
InitializeComponent()
Me
.RadSpellChecker1.SpellCheckMode = Telerik.WinControls.UI.SpellCheckMode.WordByWord
Me
.RadSpellChecker1.AutoSpellCheckControl =
Me
.RadTextBox1
Threading.Thread.CurrentThread.CurrentCulture = CulturaEspanol
Me
.RadTextBox1.CharacterCasing = CharacterCasing.Upper
Dim
textBoxControlSpellChecker
As
TextBoxSpellChecker =
Me
.RadSpellChecker1.GetControlSpellChecker(
GetType
(RadTextBox))
Dim
documentSpellChecker
As
DocumentSpellChecker = TryCast(textBoxControlSpellChecker.SpellChecker, DocumentSpellChecker)
textBoxControlSpellChecker.ShowAllCapitalLettersWord=
True
documentSpellChecker.SpellCheckingCulture= CulturaEspanol
documentSpellChecker.AddDictionary(
New
MySpanishDictionary(), CulturaEspanol)
End
Sub
Public
Class
MySpanishDictionary
Inherits
WordDictionary
Protected
Overrides
Sub
EnsureDictionaryLoadedOverride()
Using ms
As
MemoryStream =
New
MemoryStream(My.Resources.es_ES)
Me
.Load(ms)
End
Using
End
Sub
End
Class
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Dess | Tech Support Engineer, Sr.
Progress Telerik