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

Word Counts with RadRichTextBox

3 Answers 117 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 04 Jun 2011, 06:51 AM
Are there any methods or samples that demonstrate obtaining word counts from a RadDocument? 

Thanks,

3 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 06 Jun 2011, 12:40 PM
Hi Dave,

You can use the GetStatisticsInfo method of RadDocument to obtain a DocumentStatisticsInfo object, which contains information about the following parameters as properties:
  • int PagesCount
  • int SectionsCount
  • int WordsCount
  • int CharactersCount
  • int SpacesCount
  • int ParagraphsCount
  •  int LinesCount
You can see a sample use of the statistics in our online demo by choosing the "Show statistics" option from the view tab in the ribbon bar. The code of the demo is visible by checking the Source tab in the top-right corner. It is also included in the installation, under the "Demo" folder (located where your Binaries folder is).

Kind regards,
Iva
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Jay
Top achievements
Rank 1
Iron
Iron
commented on 09 Oct 2023, 10:01 PM

Doesn't work. I have a document with 4759 characters but 61 spaces and 24 words. Yeah. Right. Total junk.
Dimitar
Telerik team
commented on 10 Oct 2023, 06:40 AM

Hi Jay, 

I am sorry to hear about your experience with the control and that this functionality does not work. I want to investigate but without a document, I cannot do that. I would suggest creating a new post or a ticket and attaching a sample document there. This way we can see what is causing this and fix the issue. 

I want to apologize for the inconvenience this issue is causing you. 

Regards,

Dimitar

0
John
Top achievements
Rank 1
answered on 31 Jul 2013, 03:51 PM
What happened to this method on the RadDocument API and the online demo?  I can't find either instance.  This method would prove very helpful for tracking the character count of a document.

Thanks,
John
0
Iva Toteva
Telerik team
answered on 02 Aug 2013, 11:15 AM
Hello John,

The statistics option was indeed removed from the UI of the demos in the latest versions. However, you can easily add a button in the Ribbon UI and handle the click event like this:

private void Statistics_Click(object sender, RoutedEventArgs e)
{           
    DocumentStatisticsInfo statisticsInfo = this.radRichTextBox.Document.GetStatisticsInfo();
    MessageBox.Show(statisticsInfo.ToString(), "Document Statistics", MessageBoxButton.OK);
}

You can also use the properties of the DocumentStatisticsInfo class to prepare a different string using the properties listed in my previous post.

I hope this helps.

Regards,
Iva Toteva
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
RichTextBox
Asked by
Dave
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
John
Top achievements
Rank 1
Share this question
or