0

It's a very hard question and I searched for it and I didn't find any good answer! I want to read (key) Bookmarks of Ms Word and set the vlaue in Word with Java program language! how can I do it? with Apache POI didn't work! :( thanks

A R
  • 425
  • 1
  • 5
  • 11
  • should you realy do this in java? .Net is look like much more reasonable. Can you write small project in c#, and (if required) - call its exe from java? – evgenyl Mar 21 '13 at 08:42
  • 1
    I should do it in Java! unfortunately! – A R Mar 21 '13 at 09:51

2 Answers2

3

Ok I've found the solution, and wrote the program. this link maybe help you! http://apache-poi.1045710.n5.nabble.com/How-to-read-the-value-of-bookmarks-docx-td5710184.html but it's just for new Ms Word (.docx) For old version (.doc) I wrote a method by my self but it didn't work correctly. for old version we should use org.apache.poi.hwpf but for new version org.apache.poi.xwpf! and for controlling Ms Word or MS Office we should use Jacob Project. If you have questions you can ask me again

A R
  • 425
  • 1
  • 5
  • 11
0

You could do this with docx4j.

The challenge is that bookmarks are point tags which surround arbitrary content.

So if your intent is to replace the content of a bookmark, you'd be better off considering an alternative approach.

See this presentation for suggestions.

JasonPlutext
  • 15,352
  • 4
  • 44
  • 84