• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Replace a placeholder with image in word using Apache poi?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Ranch Hand
Posts: 32
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic