add image to XWPFDocument results in error

May 7, 2014 at 11:04 AM
I also posted this message on stackoverflow: click here

I want to add an image to a XWPFDocument. I've created a memoryStream containing the image. (which is correct because If I render the base64 string from it, this is correct).
But if I add the image with the following code:
XWPFParagraph p2 = wordDoc.CreateParagraph();
XWPFRun r2 = p2.CreateRun();
r2.AddPicture(pictureData, (int)PictureType.PNG, "image1", 800, 600);
this results in the following error when I download the document:
“The file <document filename> cannot be opened because there are problems with the contents”
So my question is, what am I missing, what am I doing wrong? Couldn't find any documentation about images into a XWPF document.
Coordinator
May 12, 2014 at 3:45 PM
This is a bug in NPOI 2.0.6. It will be fixed in NPOI 2.1
Marked as answer by tonyqus on 5/19/2014 at 9:14 PM
Coordinator
May 15, 2014 at 4:22 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.