title: Java Apache-POI XWPF how to copy or output bitmaps?
body: <p>Done a bit of research on this and it seems there have been bugs relating to this in the past, I'm unsure if they're solved in the lastest version.</p>
  <p>I'm reading a docx template, doing a few mods and outputting it. I'm copying all elements of the document fine except for bitmaps, a marker appears where the bitmap should be containing the text, &quot;this image cannot currently be displayed&quot;. I've had a few goes at doing it.</p>
  <p>What is the recommended way of copying a bitmap from one document to another?</p>
  <p>I can get images as follows:</p>
  <blockquote>
  <p>List piclist = template.getAllPictures();</p>
  <p>XWPFPictureData picture = (XWPFPictureData)piclist.get(i);</p>
  </blockquote>
  <p>But I'm not sure how to copy that into my new document.</p>
  <p>I've tried a test adding a single bitmap from a file and this code creates a Word document that gives an error and fails to load into Word:</p>
  <blockquote>
  <p>InputStream pic = new FileInputStream(&quot;filename.gif&quot;);</p>
  <p>outputDoc.addPictureData(pic, outputDoc.PICTURE_TYPE_GIF);</p>
  </blockquote>
  <p>Any help greatly appreciated. Very impressed generally with Apache-POI.</p>