Package org.docx4j.dml.wordprocessingDrawing

Examples of org.docx4j.dml.wordprocessingDrawing.Inline


        mappings.put("rEmbedId", this.getRelLast().getId());
        mappings.put("id1", Integer.toString(id1));
        mappings.put("id2", Integer.toString(id2));

        Object o = org.docx4j.XmlUtils.unmarshallFromTemplate(ml, mappings);
        Inline inline = (Inline) ((JAXBElement) o).getValue();
       
    return inline;   
  }
View Full Code Here


     
          String filenameHint = null;
          String altText = null;
          int id1 = 0;
          int id2 = 1;               
          Inline inline = null;
          long cxl = 0;
          long cyl = 0;
          try {
            cxl = Long.parseLong(cx);
            cyl = Long.parseLong(cy);
View Full Code Here

           
//        System.out.println(imagePart.getContentType());
//        System.out.println(imagePart.getClass().getName());
        assertTrue(imagePart instanceof ImageBmpPart);
       
        Inline inline = imagePart.createImageInline( filenameHint, altText,
          id1, id2);
       
        // Now add the inline in w:p/w:r/w:drawing
    org.docx4j.wml.ObjectFactory factory = new org.docx4j.wml.ObjectFactory();
    org.docx4j.wml.P  p = factory.createP();
View Full Code Here

       
            String filenameHint = null;
            String altText = null;
            int id1 = 0;
            int id2 = 1;               
            Inline inline = null;
            long cxl = 0;
            long cyl = 0;
            try {
              cxl = ef.getExtent().getCx();
              cyl = ef.getExtent().getCy();
View Full Code Here

      if (doc instanceof HWPFDocument
          && ((HWPFDocument) doc).getPicturesTable().hasPicture(run)) {
       
        Picture picture = doc.getPicturesTable().extractPicture(run,
            true);
        Inline inline;
        try {
          BinaryPartAbstractImage imagePart = BinaryPartAbstractImage
              .createImagePart(wordMLPackage, picture.getContent());

          long cx = UnitsOfMeasurement
View Full Code Here

      String filenameHint, String altText,
      int id1, int id2) throws Exception {
   
        BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, bytes);
   
        Inline inline = imagePart.createImageInline( filenameHint, altText,
          id1, id2, false);
       
        // Now add the inline in w:p/w:r/w:drawing
    org.docx4j.wml.ObjectFactory factory = Context.getWmlObjectFactory();
    org.docx4j.wml.P  p = factory.createP();
View Full Code Here

      String filenameHint, String altText,
      int id1, int id2, long cx) throws Exception {
   
        BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, bytes);
   
        Inline inline = imagePart.createImageInline( filenameHint, altText,
          id1, id2, cx, false);
       
        // Now add the inline in w:p/w:r/w:drawing
    org.docx4j.wml.ObjectFactory factory = Context.getWmlObjectFactory();
    org.docx4j.wml.P  p = factory.createP();
View Full Code Here

      //being assigned to this InlineDrawingML object.
      //See: RunML.initChildren().
      throw new IllegalArgumentException("Unsupported Docx Object = " + o);     
    }
   
    Inline inline = (Inline) list.get(0);
//    if (inline.getExtent() != null) {
//      int cx = Long.valueOf(inline.getExtent().getCx()).intValue();
//      cx = StyleSheet.emuToPixels(cx);
//      int cy = Long.valueOf(inline.getExtent().getCy()).intValue();
//      cy = StyleSheet.emuToPixels(cy);
//      //this.extentInPixels = new Dimension(cx, cy);
//    }
   
    if (inline.getEffectExtent() != null) {
      //this.effectExtent = new CTEffectExtent(inline.getEffectExtent());
    }
   
    if (inline.getGraphic() != null) {
     
      byte[] imagedata = BinaryPartAbstractImage.getImage(wordMLPackage,
          inline.getGraphic() );
      Image img = Image.getInstance( imagedata );
      if (paraParent instanceof Document) {       
        ((Document)paraParent).add(img);
      } else if (paraParent instanceof PdfPTable) {       
        ((PdfPTable)paraParent).addCell(img);
View Full Code Here

      int id1, int id2) throws Exception {
   
        BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage,
            sourcePart, bytes);
   
        Inline inline = imagePart.createImageInline( filenameHint, altText,
          id1, id2, false);
       
        // Now add the inline in w:p/w:r/w:drawing
    org.docx4j.wml.ObjectFactory factory = Context.getWmlObjectFactory();
    org.docx4j.wml.P  p = factory.createP();
View Full Code Here

    public void inlineToDocx(WordprocessingMLPackage wordPackage, Text text, Object paramValue, Matcher paramsMatcher) {
        try {
            Image image = new Image(paramValue, paramsMatcher);
            if (image.isValid()) {
                BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordPackage, image.imageContent);
                Inline inline = imagePart.createImageInline("", "", docxUniqueId1++, docxUniqueId2++, false);
                ImageSize oldSize = imagePart.getImageInfo().getSize();
                double widthExtent = (double) image.width / oldSize.getWidthPx();
                double heightExtent = (double) image.height / oldSize.getHeightPx();
                inline.getExtent().setCx((long) (inline.getExtent().getCx() * widthExtent));
                inline.getExtent().setCy((long) (inline.getExtent().getCy() * heightExtent));
                org.docx4j.wml.Drawing drawing = new org.docx4j.wml.ObjectFactory().createDrawing();
                R run = (R) text.getParent();
                run.getContent().add(drawing);
                drawing.getAnchorOrInline().add(inline);
                text.setValue("");
View Full Code Here

TOP

Related Classes of org.docx4j.dml.wordprocessingDrawing.Inline

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.