Can anyone please help me to add image into word document (.docx) header using Apache POI's XWPF component?.
I tried very hard, but unable to find solution.
Can anyone please help me to add image into word document (.docx) header using Apache POI's XWPF component?.
I tried very hard, but unable to find solution.
XWPFDocument doc = new XWPFDocument();
FileInputStream fis = new FileInputStream("/images/image.png");
XWPFParagraph par1 = doc.createParagraph();
XWPFRun runAppName = par1.createRun();
runAppName.addPicture(fis, Document.PICTURE_TYPE_PNG, "image.png", 257, 185);
doc.write(new FileOutputStream(new File("/folder/document.docx")));