Hi,

Thanks for testing and validating my code

As you said I downloaded the trunk version from svn (git svn clone 
https://svn.apache.org/repos/asf/poi/trunk poisvngit --revision HEAD), then I 
built using ant jar. I added these jars into my project and then I assume now I 
get the latest version. However it did not work.

Still getting
java.lang.ClassCastException: 
org.apache.xmlbeans.impl.values.XmlComplexContentImpl cannot be cast to 
org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DQuadBezierTo
        at 
org.openxmlformats.schemas.drawingml.x2006.main.impl.CTPath2DImpl.addNewQuadBezTo(Unknown
 Source)
        at 
org.apache.poi.xslf.usermodel.XSLFFreeformShape.setPath(XSLFFreeformShape.java:85)
        at 
org.reactome.server.rd2pptx.poi.TestBoneShape.main(TestBoneShape.java:22)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)


I tried xmlbeans version 2.3.0 and version 2.6.0 also but I don't this is the 
problem. I am also running Java 8 on OS X

Thanks

On Mon, Aug 23, 2016 at 12:05 PM, Dominik Stadler <domi... <>@gmx.at>
wrote:
Hi,

Your sample code works with current POI trunk, maybe you can try with the
latest version or at least a recent nightly build to see if your problem is
actually fixed there already.

Dominik.

On Mon, Aug 22, 2016 at 11:51 AM, Guilherme Viteri <gvit... <>@ebi.ac.uk>
wrote:

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/38971376/apache-poi-xslfconnectorshape 
<http://stackoverflow.com/questions/38971376/apache-poi-xslfconnectorshape>

http://stackoverflow.com/questions/39001499/apache-poi- 
<http://stackoverflow.com/questions/39001499/apache-poi->
xslfautoshape-shape-offset-property <http://stackoverflow.com/ 
<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