title: How to insert a image in word document with Apache POI?
body: <p>I have this code:</p>
  
  <pre><code>public class ImageAttachmentInDocument {
      /**
       * @param args
       * @throws IOException
       * @throws InvalidFormatException 
       */
      public static void main(String[] args) throws IOException, InvalidFormatException {
  
          XWPFDocument doc = new XWPFDocument();   
          FileInputStream is = new FileInputStream("encabezado.jpg");
          doc.addPictureData(IOUtils.toByteArray(is), doc.PICTURE_TYPE_JPEG);
  
  
          XWPFParagraph title = doc.createParagraph();    
          XWPFRun run = title.createRun();
          run.setText("Fig.1 A Natural Scene");
          run.setBold(true);
          title.setAlignment(ParagraphAlignment.CENTER);
  
          FileOutputStream fos = new FileOutputStream("test4.docx");
          doc.write(fos);
          fos.flush();
          fos.close();        
      }
  }
  </code></pre>
  
  <p>(I am using Apache POI 3.11 and xmlbeans-2.3.0 in eclipse IDE)</p>
  
  <p>when I generate the document, the image is not displayed</p>
  
  <p>What am I doing wrong?</p>