Skip to main content
Participant
May 20, 2008
Question

Word count for Microsoft Word using ColdFusion

  • May 20, 2008
  • 1 reply
  • 502 views
Is there a way to get the word count of a Microsoft Word document using Coldfusion's COM objects? At the moment I have code which converts the word document to a string then counts the words however I need a way to access the exact wordcount that is specified in the Word Document.

Thanks in advance!
This topic has been closed for replies.

1 reply

Inspiring
May 20, 2008
mattbrowne wrote:
> Is there a way to get the word count of a Microsoft Word document using
> Coldfusion's COM objects? At the moment I have code which converts the word
> document to a string then counts the words however I need a way to access the
> exact wordcount that is specified in the Word Document.

cf has a COM interface & cf8 has dotnet connectivity but i don't think anyone
will recommend that you install office on the server. instead you probably might
want to give POI a shot. see

http://cfsearching.blogspot.com/2008/01/ms-word-metadata-with-poi-and.html

for an example. note that you'll need to get the 3.01 *scratchpad* jar for this
from:

http://repo1.maven.org/maven2/org/apache/poi/poi-scratchpad/3.0.1-FINAL/

and either stick it on your class path or use mark's javaloader.

btw unless the user actually updates the word count you won't get anything.