Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I know you have to use
C#
\ulwave
and
C#
\ulnone
in the RTF, but I have no idea beyond this. For example..

I want the text to be spelled correctly. If I spelled "Hi" like "Hu" then I want it to put the red wavy line under it, and multiple lines of text if need be.

Could anyone help?

What I have tried:

C#
\ulwave

\ulnone


But I have no idea how to accomplish what I want..
Posted
Updated 31-Mar-20 15:00pm

1 solution

I think you need to start breaking your problem into smaller, manageable units of work

1) Split the text into words/token, where tokens may be space, punctuation)
2) look at using a RTF 'Builder' to build the RTF Text - eg RichText Builder (StringBuilder for RTF)[^]
3) for each word (possibly ignoring simple words), spell-check the word
4) if the spell-check says the word is bad, add the word with it's underline sequence using the RTFBuilder else add the word, remembering to add the space/punc tokens
5) at the end of the words (that) builder has a ToString(), that can then be used as the source for the RichTextBox

This is an iterative process - (3) for example may break down into a number of sub-steps, but you could create a simple dictionary/list of good words and test with your words first
 
Share this answer
 
Comments
The Magical Magikarp 2-Apr-20 0:06am    
I don't quite understand..
Garth J Lancaster 2-Apr-20 1:30am    
hmmm .. you asked a generic question, without posting any code that you had written. I gave you one possible breakdown of how to accomplish your task, you could use a StringBuilder if you knew how to construct RTF - hence why I've suggested something simpler ....

what exactly don't you understand ?
The Magical Magikarp 4-Apr-20 0:19am    
I don't understand the part where I would split the text into words/tokens, and the part where you said

"at the end of the words (that) builder has a ToString(), that can then be used as the source for the RichTextBox"
Garth J Lancaster 4-Apr-20 1:17am    
I think you need to start reading up on functions, classes, methods, in order for you to start being able to break things down and then build functionality piece by piece - it seems you're intent on wasting my time by not applying yourself

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900