java - Docx4j - Images in the document -
how can remove image docx4j.
say have 10 images, , want replace 8 images own byte array/binary data, , want delete remaining 2.
i having trouble in locating images.
is somehow possible replace text placeholders in document images?
refer post : http://vixmemon.blogspot.com/2013/04/docx4j-replace-text-placeholders-with.html
for(object obj : elemetns){ if(obj instanceof tbl){ tbl table = (tbl) obj; list rows = getallelementfromobject(table, tr.class); for(object trobj : rows){ tr tr = (tr) trobj; list cols = getallelementfromobject(tr, tc.class); for(object tcobj : cols){ tc tc = (tc) tcobj; list texts = getallelementfromobject(tc, text.class); for(object textobj : texts){ text text = (text) textobj; if(text.getvalue().equalsignorecase("${my_place_holder}")){ file file = new file("c:\\image.jpeg"); p paragraphwithimage = addinlineimagetoparagraph(createinlineimage(file)); tc.getcontent().remove(0); tc.getcontent().add(paragraphwithimage); } } system.out.println("here"); } } system.out.println("here"); } } wordmlpackage.save(new java.io.file("c:\\result.docx"));
Comments
Post a Comment