Quantcast
Channel: NPOI
Viewing all articles
Browse latest Browse all 1621

New Post: add image to XWPFDocument results in error

$
0
0
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.

Viewing all articles
Browse latest Browse all 1621

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>