Dear Developers,

Is there anyone monitoring the stack overflow forum for #apache-poi ?

I have created a couple of post but I haven't gotten any replies recently

http://stackoverflow.com/questions/38971376/apache-poi-xslfconnectorshape 
<http://stackoverflow.com/questions/38971376/apache-poi-xslfconnectorshape>
http://stackoverflow.com/questions/39001499/apache-poi-xslfautoshape-shape-offset-property
 
<http://stackoverflow.com/questions/39001499/apache-poi-xslfautoshape-shape-offset-property>


Besides that, I have one more issue when drawing XSLFFreeFormShape. I am trying 
to draw a kind of bone shape, however I am getting an exception in the 
low-level xml classes. I am adding the class.

public class TestBoneShape {

    public static void main(String[] args) {
        try {
            XMLSlideShow pptx = new XMLSlideShow();
            XSLFSheet slide = pptx.createSlide();

            XSLFFreeformShape freeformShape = slide.createFreeform();

            freeformShape.setPath(boneShape(300, 300, 200, 100, 20));
            freeformShape.setLineColor(Color.RED);
            freeformShape.setAnchor(new Rectangle2D.Double(300, 300, 500, 200));

            FileOutputStream out = new FileOutputStream("custom-shape.pptx");
            pptx.write(out);
            out.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    static Path2D.Double boneShape(double x,
                                double y,
                                double width,
                                double height,
                                double loopWidth) {

        Path2D.Double bone = new Path2D.Double();
        double right = x + width;
        double bottom = y + height;

        double xAux = x + loopWidth;
        double yAux = y + loopWidth / 2;
        bone.moveTo(xAux, yAux);
        xAux = right - loopWidth;
        bone.lineTo(xAux, yAux);
        yAux = y + height / 2;
        bone.quadTo(right, y, right, yAux);

        xAux = right - loopWidth;
        yAux = bottom - loopWidth / 2;
        bone.quadTo(right, bottom, xAux, yAux);

        xAux = x + loopWidth;
        bone.lineTo(xAux, yAux);
        yAux = y + height / 2;
        bone.quadTo(x, bottom, x, yAux);

        xAux = x + loopWidth;
        yAux = y + loopWidth / 2;
        bone.quadTo(x, y, xAux, yAux);

        bone.closePath();

        return bone;
    }
}


Thank you
Guilherme.




Reply via email to