I am making a "reading speed tester" application using RichTextBox.
I need to colorize text fragments by moving caret in next position. So, when I load plain text file in RichTextBox - I can get proper caret position using rtb.CaretPosition.
But when i load rtf, CaretPosition property returns me '60' for first character. So it's correct, but I want to get caret position in text without any formatting (special symbols).
Can i do that without parsing rtf and converting one caret position to another manually ?
Related
I'm looking for a code-how that can bold selective words and/or lines of text within one of WPF's RichTextBoxes, so that, for example, I could have code that ensures the word bananabread would be automatically set to bold whenever it were typed. Another example of this could be setting an entire line to bold if it begins with the word "Therefore."
I'm aware that you can bold specific lines via XAML, and I know that pressing Ctrl + B can bold specific words while in the editor itself, but how can I go about doing this through C#?
There's a character in a text file supplied to my software that I cannot read back out.
I can't even paste this character into the browser to search for it - it just inserts a white space.
If I read this text file's contents, the character comes out as '\f', which is a form feed character.
Notepad shows a bold up arrow. Other text editors (Sublime) shows an unrecognized symbol.
How can I find out what character this is?
The question was
How can I find out what character set this is from?
ASCII.(https://en.wikipedia.org/wiki/Page_break#Form_feed)
To answer the question of why it does not display... think of it as a command. When a printer(for example) sees a form feed, it advances the page by 1.
You cannot see it in your editor because per #dlatikay :
notepad renders it as ↑ because that's a visual cue for "feed paper
until first line of next page
I'm trying to copy an equation from word into a richtextbox control in winform.
The copy and the paste are done normally.But the paste of the equation is done as an image not as an equation file.(I cannot decode the pasted element in order to get the unicode text from it).
Is there a way to conserve the original component type after the paste is done ?
Or convert the image file to equation and get the unicode text from it ?
Any help would be appreciated
I have some RTF text. Sometimes text contain some images. Images is displayed inside any rtf editor, but i cannot get images positions programmatically.
I have used RichTextBox control for RTF parsing, but is unable to detect image positions inside text in RichTextBox control
So, does anybody know how to parse RTF and get images positions inside text programmatically using C#?
You might take a look at http://www.codeproject.com/KB/string/nrtftree.aspx it is open source and able to extract images, so I hope this helps.
In my project I want to count lines displayed by richtextbox in C# with word wrap property set true. For example, in richtextbox, I write a text, and when text reaches the width of the richtextbox, then it automatically goes to second line. So what happens is the text contains actually one line but it is displayed in two lines. So I want to know how can I count this as two lines instead of one? Help will be really appreciated.
You may go for RichTextBox.GetLineFromCharIndex Method
Retrieves the line number from the
specified character position within
the text of the RichTextBox control. If WordWrap is set to false, no portion of the line wraps to the next, and the method returns 0 for the specified character index.
Also, check out this link.