Examples of BinaryPartAbstractImage


Examples of org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage

    SlidePart slidePart = presentationMLPackage.createSlidePart(pp, layoutPart,
        new PartName("/ppt/slides/slide1.xml"));
       
    // Add image part
    File file = new File(System.getProperty("user.dir") + "/src/test/resources/images/greentick.png" );
        BinaryPartAbstractImage imagePart
          = BinaryPartAbstractImage.createImagePart(presentationMLPackage, slidePart, file);
   
           
        // Add p:pic to slide
    slidePart.getJaxbElement().getCSld().getSpTree().getSpOrGrpSpOrGraphicFrame().add(
        createPicture(imagePart.getSourceRelationship().getId()));
   

    // Do it again on another slide
    SlidePart slidePart2 = presentationMLPackage.createSlidePart(pp, layoutPart,
        new PartName("/ppt/slides/slide2.xml"));
View Full Code Here

Examples of org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage

      Part sourcePart,
      byte[] bytes,
      String filenameHint, String altText,
      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

Examples of org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage

    //todo merge cells - set up right anchor for merged cells, cause now image it written only to 1 cell
    public void inlineToXlsx(SpreadsheetMLPackage pkg, WorksheetPart worksheetPart, Cell newCell, Object paramValue, Matcher matcher) {
        try {
            Image image = new Image(paramValue, matcher);
            if (image.isValid()) {
                BinaryPartAbstractImage xlsxImage = null;
                xlsxImage = BinaryPartAbstractImage.createImagePart(pkg, worksheetPart, image.imageContent);
                CTTwoCellAnchor anchor = new CTTwoCellAnchor();
                CTMarker from = new CTMarker();
                CellReference cellReference = new CellReference("", newCell.getR());
                from.setCol(cellReference.getColumn() - 1);
View Full Code Here

Examples of org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage

    @Override
    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();
View Full Code Here

Examples of org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage

    org.xlsx4j.sml.CTDrawing drawing = org.xlsx4j.jaxb.Context.getsmlObjectFactory().createCTDrawing();
        worksheet.getJaxbElement().setDrawing(drawing);
            drawing.setId( drawingRel.getId() );    
   
    // Create image part and add to Drawing part
        BinaryPartAbstractImage imagePart
          = BinaryPartAbstractImage.createImagePart(pkg, drawingPart,
              FileUtils.readFileToByteArray(new File(imagefilePath) ));
        String imageRelID = imagePart.getSourceRelationship().getId();
   
    // Create and set drawing part content
        // Take your pick ..
        // .. build it using code
//        drawingPart.setJaxbElement(
View Full Code Here

Examples of org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage

    SlidePart slidePart = presentationMLPackage.createSlidePart(pp, layoutPart,
        new PartName("/ppt/slides/slide1.xml"));
       
    // Add image part
    File file = new File("data/pptx4j/greentick.png" );
        BinaryPartAbstractImage imagePart
          = BinaryPartAbstractImage.createImagePart(presentationMLPackage, slidePart, file);
   
           
        // Add p:pic to slide
    slidePart.getJaxbElement().getCSld().getSpTree().getSpOrGrpSpOrGraphicFrame().add(
        createPicture(imagePart.getSourceRelationship().getId()));
   

    // Do it again on another slide
    SlidePart slidePart2 = presentationMLPackage.createSlidePart(pp, layoutPart,
        new PartName("/ppt/slides/slide2.xml"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.