Counting Text - Bullets and Numbers Not Counted RRS feed

  • Question

  • I am trying to count characters in a document.  If I use the "Word Count" button in Word 2010, it gives me counts for both characters with spaces and without spaces, that include the bullets in bulleted text and numbers in numbered text.  This is what I want.

    When I count the same document using Visual Studio 2010, Word 2010, Word Object Model, it gives me the counts without the bullets and numbers.  Is there a parameter that I'm missing in my C# program?

    Using wordCount = range.ComputeStatistics(Word.WdStatistic.wdStatisticWords); Thanks

    Friday, May 13, 2011 6:44 PM


  • I found my answer. 

    If I use " int chars = oDoc.ComputeStatistics(Word.WdStatistic.wdStatisticCharacters); " it counts correctly when counting on the document object.  If I use "wordCount = range.ComputeStatistics(Word.WdStatistic.wdStatisticWords); " when traversing the range object, it strips the bullets and numering from the text. 

    • Marked as answer by OfficeNewBe Friday, May 13, 2011 6:54 PM
    Friday, May 13, 2011 6:54 PM