We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to create shapes from lines?

On some of our Visio diagrams we create custom shapes by using the line tool to draw a series of lines. Visio will automatically turn that into a shape once the last line connects with the first line. Is there a way to mimic that in the Java Aspose.Diagram library? I’m looking at the options for saving a shape to a diagram and it looks like they all require a master to be defined. I don’t know what I would set the master to in this case.


Thanks for your inquiry.

We have logged a ticket as DIAGRAMJAVA-50616 in our issue tracking system for the feature investigation which you require. We have linked the ticket ID with this post so that you will receive notification once ticket is resolved. Please be patient and spare us little time.

We are sorry for the inconvenience.


Please use following code snippet to create shapes from lines without using master:

Shape shape = new Shape(); 
shape.getXForm().getWidth().setValue( 1); 
shape.getXForm().getHeight().setValue( 1); 
shape.getXForm().getPinY().setValue( 1); 
shape.getText().getValue().add(new Txt("hello")); 
int idx = diagram.getPages().get(0).getShapes().add(shape); 
shape.setID( idx + 1);  

In case of further assistance, please feel free to let us know.