Package org.openxmlformats.schemas.wordprocessingml.x2006.main

Examples of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPicture


        byte[] data1 = new byte[100];
        int idx1 = ppt1.addPicture(data1, XSLFPictureData.PICTURE_TYPE_JPEG);

        XSLFSlide slide1 = ppt1.createSlide();
        XSLFPictureShape shape1 = slide1.createPicture(idx1);
        CTPicture ctPic1 = (CTPicture)shape1.getXmlObject();
        ctPic1.getNvPicPr().getNvPr().addNewCustDataLst().addNewTags().setId("rId99");

        XMLSlideShow ppt2 = new XMLSlideShow();

        XSLFSlide slide2 = ppt2.createSlide().importContent(slide1);
        XSLFPictureShape shape2 = (XSLFPictureShape)slide2.getShapes()[0];

        assertArrayEquals(data1, shape2.getPictureData().getData());

        CTPicture ctPic2 = (CTPicture)shape2.getXmlObject();
        assertFalse(ctPic2.getNvPicPr().getNvPr().isSetCustDataLst());

    }
View Full Code Here


        shape.setAnchor(new Rectangle());
        return shape;
    }

    public XSLFPictureShape createPicture(String rel){
        CTPicture obj = _spTree.addNewPic();
        obj.set(XSLFPictureShape.prototype(_shapeId++, rel));
        XSLFPictureShape shape = new XSLFPictureShape(obj, _sheet);
        shape.setAnchor(new Rectangle());
        return shape;
    }
View Full Code Here

        byte[] data1 = new byte[100];
        int idx1 = ppt1.addPicture(data1, XSLFPictureData.PICTURE_TYPE_JPEG);

        XSLFSlide slide1 = ppt1.createSlide();
        XSLFPictureShape shape1 = slide1.createPicture(idx1);
        CTPicture ctPic1 = (CTPicture)shape1.getXmlObject();
        ctPic1.getNvPicPr().getNvPr().addNewCustDataLst().addNewTags().setId("rId99");

        XMLSlideShow ppt2 = new XMLSlideShow();

        XSLFSlide slide2 = ppt2.createSlide().importContent(slide1);
        XSLFPictureShape shape2 = (XSLFPictureShape)slide2.getShapes()[0];

        assertTrue(Arrays.equals(data1, shape2.getPictureData().getData()));

        CTPicture ctPic2 = (CTPicture)shape2.getXmlObject();
        assertFalse(ctPic2.getNvPicPr().getNvPr().isSetCustDataLst());

    }
View Full Code Here

    /**
     * @param shapeId 1-based shapeId
     * @param rel     relationship to the picture data in the ooxml package
     */
    static CTPicture prototype(int shapeId, String rel) {
        CTPicture ct = CTPicture.Factory.newInstance();
        CTPictureNonVisual nvSpPr = ct.addNewNvPicPr();
        CTNonVisualDrawingProps cnv = nvSpPr.addNewCNvPr();
        cnv.setName("Picture " + shapeId);
        cnv.setId(shapeId + 1);
        nvSpPr.addNewCNvPicPr().addNewPicLocks().setNoChangeAspect(true);
        nvSpPr.addNewNvPr();

        CTBlipFillProperties blipFill = ct.addNewBlipFill();
        CTBlip blip = blipFill.addNewBlip();
        blip.setEmbed(rel);
        blipFill.addNewStretch().addNewFillRect();

        CTShapeProperties spPr = ct.addNewSpPr();
        CTPresetGeometry2D prst = spPr.addNewPrstGeom();
        prst.setPrst(STShapeType.RECT);
        prst.addNewAvLst();
        return ct;
    }
View Full Code Here

        }
        return _data;
    }

    private String getBlipId(){
        CTPicture ct = (CTPicture)getXmlObject();
        return ct.getBlipFill().getBlip().getEmbed();
    }
View Full Code Here

        XSLFPictureShape p = (XSLFPictureShape)sh;
        String blipId = p.getBlipId();
        String relId = getSheet().importBlip(blipId, p.getSheet().getPackagePart());

        CTPicture ct = (CTPicture)getXmlObject();
        CTBlip blip = ct.getBlipFill().getBlip();
        blip.setEmbed(relId);

        CTApplicationNonVisualDrawingProps nvPr = ct.getNvPicPr().getNvPr();
        if(nvPr.isSetCustDataLst()) {
            // discard any custom tags associated with the picture being copied
            nvPr.unsetCustDataLst();
        }
View Full Code Here

    /**
     * @param shapeId 1-based shapeId
     * @param rel     relationship to the picture data in the ooxml package
     */
    static CTPicture prototype(int shapeId, String rel) {
        CTPicture ct = CTPicture.Factory.newInstance();
        CTPictureNonVisual nvSpPr = ct.addNewNvPicPr();
        CTNonVisualDrawingProps cnv = nvSpPr.addNewCNvPr();
        cnv.setName("Picture " + shapeId);
        cnv.setId(shapeId + 1);
        nvSpPr.addNewCNvPicPr().addNewPicLocks().setNoChangeAspect(true);
        nvSpPr.addNewNvPr();

        CTBlipFillProperties blipFill = ct.addNewBlipFill();
        CTBlip blip = blipFill.addNewBlip();
        blip.setEmbed(rel);
        blipFill.addNewStretch().addNewFillRect();

        CTShapeProperties spPr = ct.addNewSpPr();
        CTPresetGeometry2D prst = spPr.addNewPrstGeom();
        prst.setPrst(STShapeType.RECT);
        prst.addNewAvLst();
        return ct;
    }
View Full Code Here

        }
        return null;
    }

    private CTBlip getBlip(){
        CTPicture ct = (CTPicture)getXmlObject();
        return ct.getBlipFill().getBlip();
    }
View Full Code Here

        if (id.isEmpty()) return null;
        return id;
    }

    public Insets getBlipClip(){
        CTPicture ct = (CTPicture)getXmlObject();
        CTRelativeRect r = ct.getBlipFill().getSrcRect();
        return (r == null) ? null : new Insets(r.getT(), r.getL(), r.getB(), r.getR());
    }
View Full Code Here

        XSLFPictureShape p = (XSLFPictureShape)sh;
        String blipId = p.getBlipId();
        String relId = getSheet().importBlip(blipId, p.getSheet().getPackagePart());

        CTPicture ct = (CTPicture)getXmlObject();
        CTBlip blip = ct.getBlipFill().getBlip();
        blip.setEmbed(relId);

        CTApplicationNonVisualDrawingProps nvPr = ct.getNvPicPr().getNvPr();
        if(nvPr.isSetCustDataLst()) {
            // discard any custom tags associated with the picture being copied
            nvPr.unsetCustDataLst();
        }
        if(blip.isSetExtLst()) {
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPicture

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.