https://bz.apache.org/bugzilla/show_bug.cgi?id=65487

            Bug ID: 65487
           Summary: Problems to include image in header and footer
           Product: POI
           Version: 4.1.2-FINAL
          Hardware: PC
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: XWPF
          Assignee: dev@poi.apache.org
          Reporter: afamo...@gmail.com
  Target Milestone: ---

I have used this block of code

public void createPicture(String blipId, int id, long cx, long cy, XWPFRun run,
String imageName) {

  run.setFontFamily("Elaudos Signature");
  CTInline line = run.getCTR().addNewDrawing().addNewInline();

  String picXml = "" + "<a:graphic
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\";>"
    + "   <a:graphicData
uri=\"http://schemas.openxmlformats.org/drawingml/2006/picture\";>"
    + "      <pic:pic
xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\";>"
   + "         <pic:nvPicPr>" + "            <pic:cNvPr id=\"" + id + "\"
name=\"" + imageName + "\"/>"
   + "            <pic:cNvPicPr/>" + "         </pic:nvPicPr>" + "        
<pic:blipFill>"
   + "            <a:blip r:embed=\"" + blipId
   + "\"
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"/>"
   + "            <a:stretch>" + "               <a:fillRect/>" + "           
</a:stretch>"
   + "         </pic:blipFill>" + "         <pic:spPr>" + "           
<a:xfrm>"
   + "               <a:off x=\"0\" y=\"0\"/>" + "               <a:ext cx=\""
+ cx 
   + "\" cy=\"" + cy
   + "\"/>" + "            </a:xfrm>" + "            <a:prstGeom
prst=\"rect\">"
   + "               <a:avLst/>" + "            </a:prstGeom>" + "        
</pic:spPr>"
   + "      </pic:pic>" + "   </a:graphicData>" + "</a:graphic>";
  XmlToken token = null;
  try {
    token = XmlToken.Factory.parse(picXml);
  } catch (XmlException xe) {
  xe.printStackTrace();
}

  line.set(token);
  line.setDistT(0);
  line.setDistB(0);
  line.setDistL(0);
  line.setDistR(0);
  CTPositiveSize2D extent = line.addNewExtent();
  extent.setCx(cx);
  extent.setCy(cy);
  CTNonVisualDrawingProps docPr = line.addNewDocPr();
  docPr.setId(id);
  docPr.setName(imageName);
  docPr.setDescr(imageName);
}

and the addPicture method but anything works 

The same code work in the body

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to