You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2015/11/17 15:45:09 UTC
[Bug 58237] Unable to add image to a word document header using XWPF
https://bz.apache.org/bugzilla/show_bug.cgi?id=58237
nishant <ni...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|3.12-FINAL |3.13-FINAL
--- Comment #7 from nishant <ni...@gmail.com> ---
Have tried testing with 3.13 but it still doesn't work.
Below is the code I am using
FileInputStream stream=new FileInputStream(new
File("D:/PNL.docx"));
XWPFDocument document=new XWPFDocument(stream);
XWPFHeaderFooterPolicy policy = document.getHeaderFooterPolicy();
XWPFHeader defaultHeader = policy.getDefaultHeader();
defaultHeader.addPictureData(new FileInputStream(new
File("D:/logo/xyz.jpg")), Document.PICTURE_TYPE_JPEG);
but it doesnt update the image in the document file. The document remains as
such with no modification.
This is returning size of 1:
List<XWPFPictureData> pictures = defaultHeader.getAllPictures();
System.out.println(pictures.size());
Please help validate the code.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org