none
Incorrect word count in readabilitystatistics for *some* documents RRS feed

  • Question

  • I open a MS Word (2003) document programatically and am attempting to retrieve and display the readability statistcis. For some documents, the results are in exact agreement with what you get through the Word GUI using Check Spelling and Grammar. For other documents, what is reported programatically is incorrect--always low.

    There seems to be a rough agreement between words, characters, paragraphs and sentences. That is, If I find the point in the doc (using the GUI) where the word count is about equal to what the readabilitystatistics report, then the characters, paragraphs and sentences counts are also similar (though not exact). It looks like the readability statistics just don't go through the entire range. I've examined the documents for some obvious delimiter that marks the end of the processed range, but nothing is obvious to me.

    Can anyone shed any light on this or make a suggestion?

    With a simple form with 1 listbox and an open file dialog, the code looks like this:

    Dim word As New Word.Application()
    
    Dim doc As Word.Document
    
    If OpenFileDialog1.ShowDialog = DialogResult.OK Then
       doc = word.Documents.Add(OpenFileDialog1.FileName)
       Dim rng As Word.Range = doc.Content 
    
       For Each rs As Word.ReadabilityStatistic In rng.ReadabilityStatistics 
         ListBox1.Items.Add(rs.Name & ": " & rs.Value.ToString) 
       Next
    End If
    
    word.Quit()
    
    Tuesday, February 1, 2011 12:46 AM

Answers

  • Hi Tarsa

    There have been a number of discussions about this API in the VSTO forum (http://social.msdn.microsoft.com/Forums/en-US/vsto/threads), over the years. The conclusion, confirmed by the MS support team, is that this API is faulty. There is no known fix or workaround.

    Searching the term ReadabilityStatistics in that forum should bring up those discussions, but you won't really find any additional information - it simply doesn't work.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Tarsa Tuesday, February 1, 2011 4:41 PM
    Tuesday, February 1, 2011 10:15 AM
    Moderator

All replies

  • Hi Tarsa

    There have been a number of discussions about this API in the VSTO forum (http://social.msdn.microsoft.com/Forums/en-US/vsto/threads), over the years. The conclusion, confirmed by the MS support team, is that this API is faulty. There is no known fix or workaround.

    Searching the term ReadabilityStatistics in that forum should bring up those discussions, but you won't really find any additional information - it simply doesn't work.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Tarsa Tuesday, February 1, 2011 4:41 PM
    Tuesday, February 1, 2011 10:15 AM
    Moderator
  • Thanks, Cindy.  I did see some of those wrt the passive sentences stat. Just wanted to make sure I wasn't overlooking something obvious. I guess I'll count the words myself.
    Tuesday, February 1, 2011 4:41 PM