Get word count

2 posts, 0 answers
  1. paul
    paul avatar
    2 posts
    Member since:
    Apr 2015

    Posted 03 Feb 2016 Link to this post

    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

  2. Mihail
    Mihail avatar
    223 posts

    Posted 08 Feb 2016 Link to this post

    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.

    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
Back to Top