Results 1 to 14 of 14
  1. #1
    kushagra is offline Member
    Join Date
    Oct 2008
    Posts
    12
    Rep Power
    0

    Default Open Ms Word Docs

    Hi All,

    I want to read the word count of ms word.

    One way I am reading this currently is that by reading it through POI from its summary properties.
    But word count coming over here is different from the word count that we can read from the tools-->wordCount.

    So according to my finding there can be few way.

    1. There will be anyother API by which we can read the inner word count.

    2. Run macro through Java which will then auto set the word count in its custom properties. In this I need to run the word in invisible(visible=false) mode. This I am doing by Runtime.getRuntime().exec("winword.exe path "+"file name");
    3. Use JNI to open the doc and then have to closse the doc also as I have many docs to read the docs.
    4. Any other way.


    My aplplication will run on both window and mac so please suggest me the best poosible way to do that. As there is a short time span left.

    Please help me to solve this issue.

    Thanks
    Kushagra

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    I'm mess with your title and the explanation. Do you want to open a doc file or count words(actually to count words you have to open it too, not physically) on it?

  3. #3
    kushagra is offline Member
    Join Date
    Oct 2008
    Posts
    12
    Rep Power
    0

    Default

    Hi,

    Ya my prie target is to read the counts of word in a ms word doc.

    Any solution regarding the same.

    Thanks
    Kushagra

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Read the file into a buffer and then tokenize with the space. Use of regular expressions are much better.

  5. #5
    kushagra is offline Member
    Join Date
    Oct 2008
    Posts
    12
    Rep Power
    0

    Default

    Hi,

    Same I was using but by doing this I was unable to calculate the exact word count.
    As the doc may contain table, image, hidden xml, custom tags etc.

    Thats why I use another way to access the same functionality.

    Any other way or a better solution that I have just suggested in my frst post please suggest me.


    Thanks
    Kushagra

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Ya it's going to be so hard. How about the read of the doc header. As far as I know header contain such information about the doc too.

  7. #7
    kushagra is offline Member
    Join Date
    Oct 2008
    Posts
    12
    Rep Power
    0

    Default

    Ya at the same moment I am doing the same read the word count from the doc header. But this word count also is not correct and is differ from the word count of the open document.

    And currently I am getting the word count difference of about 1000 word for every 10000 word count in reality approx.

    So any solution apart from the same.
    :)

    Thanks
    Kushagra

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Another possible solution is use of COM interfaces. But I've never work on with Java and MS doc.

  9. #9
    kushagra is offline Member
    Join Date
    Oct 2008
    Posts
    12
    Rep Power
    0

    Default

    Ya actually I want same kind of solution. So any progress which I can expect here.

    If,please help me in this also.

    Thanks
    Kushagra

  10. #10
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    I'll try to write a COM interface for this once I free with my works. It may take more time, since I've never do it before.

  11. #11
    kushagra is offline Member
    Join Date
    Oct 2008
    Posts
    12
    Rep Power
    0

    Default

    Thanks for ur help
    Please let me know in case I can provide some input.

    Thanks
    Kushagra

  12. #12
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  13. #13
    kushagra is offline Member
    Join Date
    Oct 2008
    Posts
    12
    Rep Power
    0

    Default

    Hey have you find any solution regarding the same.

    Thanks
    Kushagra

  14. #14
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Similar Threads

  1. JCreator JDK docs?
    By thejerryman in forum JCreator
    Replies: 4
    Last Post: 12-01-2008, 04:31 PM
  2. Java Docs for log4j
    By javaplus in forum Advanced Java
    Replies: 0
    Last Post: 12-14-2007, 06:06 PM
  3. showing the servlets api docs in netbeans
    By truegilly in forum New To Java
    Replies: 0
    Last Post: 12-05-2007, 09:14 PM
  4. producing DOCs
    By javaplus in forum New To Java
    Replies: 0
    Last Post: 11-18-2007, 06:08 PM
  5. packages for parsing docs files
    By gabriel in forum Advanced Java
    Replies: 1
    Last Post: 08-06-2007, 03:42 AM

Posting Permissions

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