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

SpellCheckErrorClass: 'OffsetInText' property

1 Answer 39 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 16 Jun 2009, 01:46 AM
Hi,

I am using RadControls for ASPNET AJAX Q3 2008. I'm utilising the Telerik.Web.UI.SpellChecker class to perform server-side spell checking on plain text as well as HTML strings.

I require the character offset (i.e. index) of any words failing spell check within the text string, and assumed from the documentation that the SpellCheckError.OffsetInText property would provide just what I needed (documentation below):

Telerik.Web.UI Namespace > SpellCheckError Class : OffsetInText Property
The offset in the source text. It is useful for locating the original word and replacing it with one of the suggestions.

However this property returns the zero-based order of the mistaken word within the list of the words in the text.

E.g. for the string "Two misspled wordz" the offset property would be 1 (for the "misspled" SpellCheckError) and 2 (for the "wordz" SpellCheckError).

I notice that the actual character offset is within the SpellCheckError but it's not publicly accessible (SpellCheckError.badWord.Offset)

My questions:
1) Is there any way in which to access this property for the Q3 2008 version?
2) Is this property provided publicly (e.g. in the SpellCheckError class) in a subsequent release?

Regards

Michael



 

1 Answer, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 17 Jun 2009, 11:10 AM
Hello Michael,
We have already replied to your support ticket, but I will also post the answer here, so that it is helpful to others as well:

You are correct - the OffsetInText property actually returns the word index. We will change it to return the actual offset (badWord.Offset) in the next major RadControls release. We will add a new property "WordIndex" that will return the word index. The new release (Q2 2009) will be out next month.

For now you have to use the string.IndexOf() method to find the offset of the misspelled word in the text.

Kind regards,
Lini
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Spell
Asked by
Michael
Top achievements
Rank 1
Answers by
Lini
Telerik team
Share this question
or