• Post Reply Bookmark Topic Watch Topic
  • New Topic

Replace a placeholder with image in word using Apache poi?  RSS feed

 
thirunamca arasumca
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I need to replace the placeholder with image in the word document using Apache POI. I am able to add the picture in the word document at last using Apache poi. But i don't know how to replace the placeholder with image. Can anyone please help in this?

I know it will be easy if we do it through docx4j or some other API, i am allowed to use only the Apache poi.

Thanks in advance...
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you know it's easily achieved by using some other library, my advice would be to push back on the "you must use POI" requirement. POI is great, but not the right tool for everything. Whoever made up that requirement needs to understand that.
 
thirunamca arasumca
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to use Apache POI only, i am using the CustomXWPFDocument class to add image, i changed the relation id and id pass to the method but it is not working, does anyone knows how to do this?
 
thirunamca arasumca
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I am able to insert the image but while opening the word document i am getting error "Cannot be opened because there are problems with contents: ", does anyone knows how to get rid of this.

 
Mark Beardsley
Ranch Hand
Posts: 32
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The CustomXWPFDocument class was created by a developer who logged a POI bug onto Bugzilla - https://issues.apache.org/bugzilla/show_bug.cgi?id=49765 - and, as a result, I think you would get a better response to your question by posting onto the POI user list. Do not be tempted to add to the bug as that is unlikely to meet with much approval. I would advise simply opening a new topic on the user list and both referring to the bug/class and posting your question there.
 
thirunamca arasumca
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark Beardsley wrote:The CustomXWPFDocument class was created by a developer who logged a POI bug onto Bugzilla - https://issues.apache.org/bugzilla/show_bug.cgi?id=49765 - and, as a result, I think you would get a better response to your question by posting onto the POI user list. Do not be tempted to add to the bug as that is unlikely to meet with much approval. I would advise simply opening a new topic on the user list and both referring to the bug/class and posting your question there.


Thanks for your reply. I will ask my question there also.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!