Results 1 to 9 of 9

Thread: [2005] Word Count Software/API

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    [2005] Word Count Software/API

    Anyone have any experience with using any word count software - such as Practicount?

    I'm looking for an API that will do counts of words in a .DOC file.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [2005] Word Count Software/API

    Would something like this work for you?
    vb.net Code:
    1. Public Class Form1
    2. Private WordApp As New Word.ApplicationClass()
    3.    
    4. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    5.  
    6. Dim MyDoc As Word.Document = WordApp.Documents.Open("c:\szlamany.doc")
    7. Dim DocumentWordCount As Integer = DirectCast(MyDoc.Range.ComputeStatistics(Word.WdStatistic.wdStatisticWords), Integer)
    8. MessageBox.Show(DocumentWordCount.ToString)
    9. MyDoc.Close()
    10.  
    11. End Sub
    12. End Class

  3. #3

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: [2005] Word Count Software/API

    Unfortunately the customer tells me WORD is not accurate - especially with some languages.

    I tried to contact PRACTICOUNT - and no one answers my e-mails...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [2005] Word Count Software/API

    Tell your customer that using
    Code:
    MyDoc.Words.Count.ToString
    is not accurate, but, the computestatistics is accurate.

    Test it for yourself.

    Open a word document and do tools/Word Count so you know what it should be.

    Now run that code, first with MyDoc.Words.Count.ToString and next with
    Dim DocumentWordCount As Integer = DirectCast(MyDoc.Range.ComputeStatistics(Word.WdStatistic.wdStatisticWords), Integer)

    The latter will be right on the money.

  5. #5

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: [2005] Word Count Software/API

    I guess these products like PractiCount see words that WORD does not - like in table and even in some kinds of images. And these word's need to be counted as well.

    They currently use PractiCount - but through the PractiCount UI - we are trying to integrate our new tracking software with the document folders and do our word counting through an API to a product.

    And of course the product cannot be WORD - they have expectations of performance that match these other products...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  6. #6
    New Member
    Join Date
    May 2013
    Posts
    2

    Re: [2005] Word Count Software/API

    Hi,

    did you find out the solution of counting the words?

    Thanks,

    Juraj

    Quote Originally Posted by Hack View Post
    Would something like this work for you?
    vb.net Code:
    1. Public Class Form1
    2. Private WordApp As New Word.ApplicationClass()
    3.    
    4. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    5.  
    6. Dim MyDoc As Word.Document = WordApp.Documents.Open("c:\szlamany.doc")
    7. Dim DocumentWordCount As Integer = DirectCast(MyDoc.Range.ComputeStatistics(Word.WdStatistic.wdStatisticWords), Integer)
    8. MessageBox.Show(DocumentWordCount.ToString)
    9. MyDoc.Close()
    10.  
    11. End Sub
    12. End Class

  7. #7
    New Member
    Join Date
    May 2013
    Posts
    2

    Re: [2005] Word Count Software/API

    hi, did you find some solution for counting the words? Thanks for your help.

  8. #8

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: [2005] Word Count Software/API

    No need to PM me - I prefer keep all activity on the forum itself...

    No - this never got solved in a better fashion then what is discussed here.

    If you are dealing with .DOCX files - they are simply ZIP files (rename it to .ZIP and you will see the "storage format" quite clearly.

    Google for SPIRE.DOC and you will find some libraries you can use - they are not free though...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  9. #9
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: [2005] Word Count Software/API

    Try this:
    http://pradeep1210.wordpress.com/201...erties-viewer/

    It will show you a lot of information including the "Word Count". You can customize this as per your needs and remove the entries you don't want.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width