• Post Reply Bookmark Topic Watch Topic
  • New Topic

Modifying a Word Document

 
dimpsonu arora
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a situation where I have a word document that contains images, header,footer and text. I need to read the document and change the text inside it. For example: #email# should be replaced with abc@hotmail.com.

I am able to replace if the number of characters are same (#email# is having 6 characters.) if replaced characters are less than or greater than 6 characters, my word file get corrupted. Please help me as it is reall urgent. OR suggest me some other way to resolve this problem.

Thanks In Advance.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The POI library (jakarta.apache.org/poi) can read and write Word files. It's not under active development any more, so if it doesn't work with your documents, then you are most likely out of luck.

Another option (with a learning curve) is OpenOffice, which can read and write Word files as well, and has a Java API. More information can be found here.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!