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

Get word count

1 Answer 55 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
paul
Top achievements
Rank 1
paul asked on 03 Feb 2016, 10:57 PM

I have a RichTextBox bound via a DocxDataProvider. 

I'm able to get the wordcount via the StatisticsInfo object.

Wondered if I have the RichTextBox content in a byte array, can I convert this to a readable string ?

Unable to figure out the encoding.

Thanks in advance

1 Answer, 1 is accepted

Sort by
0
Mihail
Telerik team
answered on 08 Feb 2016, 09:10 AM
Hello Paul,

If I understand you correctly you would like to count the words yourself. In order to get the document as a string, you could use the TxtFormatProvider. Here is example of how this could be done:
TxtFormatProvider txt = new TxtFormatProvider();
string documentAsText = txt.Export(this.radRichTextBox.Document);

I can recommend you the Import\Export help article where all of the available format providers are described.

Regards,
Mihail
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
RichTextBox
Asked by
paul
Top achievements
Rank 1
Answers by
Mihail
Telerik team
Share this question
or