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

Free Support Forum - aspose.com

Dynamic Connector Implementing Composition

I’m using Java api (package com.aspose.diagram) . I’m able to implement a dynamic connection between two object and change the connector shape such as:

connectorMaster = "Dynamic connector"

Shape shape = new Shape();


However, I need to implement composition between two classes (filled diamond shape). And this shape is not available in the getEndArrow().setValue(x). Is there a method that allows to either; fill the open diamond shape that is provided, change the end arrow to a custom object, or can the master shape file be edited to provide the necessary shape?


Thanks for contacting support.

Would you kindly share your sample Diagram File along with complete sample code snippet which you are trying at your end. We will test the scenario in our environment and address it accordingly.

Yes absolutely, sorry for not being clear enough. Let’s say I have a sample code like this.

package com.aspose.diagram.examples.Shapes;

import com.aspose.diagram.ConnectionPointPlace;

import com.aspose.diagram.Diagram;

import com.aspose.diagram.Page;

import com.aspose.diagram.SaveFileFormat;

import com.aspose.diagram.Shape;

import com.aspose.diagram.examples.Utils;

public class ConnectVisioSubShapes {

public static void main(String[] args) throws Exception {

// ExStart:ConnectVisioSubShapes

// The path to the documents directory.

String dataDir = Utils.getSharedDataDir(ConnectVisioSubShapes.class) + "Shapes/";

// set sub shape ids

long shapeFromId = 2;

long shapeToId = 4;

// load diagram

Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");

// access a particular page

Page page = diagram.getPages().getPage("Page-3");

// initialize connector shape

Shape shape = new Shape();



// add shape

long connecter1Id = page.addShape(shape, "Dynamic connector");

// connect sub-shapes

page.connectShapesViaConnector(shapeFromId, ConnectionPointPlace.RIGHT, shapeToId, ConnectionPointPlace.LEFT,


// save Visio drawing

diagram.save(dataDir + "ConnectVisioSubShapes_Out.vsdx", SaveFileFormat.VSDX);

// ExEnd:ConnectVisioSubShapes



By changing “shape.getLine().getEndArrow().setValue(4);”. I can modify the end arrow of the connector. I can generate aggregation (open diamond). However composition (closed diamond) is not available.bfBSY.jpg (21.8 KB)


Could you please also share the Diagram file that you are using with above shared code snippet.

Yes of course.

BasicShapes.zip (54.0 KB)


Currently, only hollow diamond of type 22 is available which can be added using following code:


In order to add support for filled/solid diamond, we have logged a feature request as DIAGRAMJAVA-50654 in our issue tracking system. We will further investigate the feasibility of the feature in details and keep you posted with the status of its implementation. Please be patient and spare us little time.

We are sorry for the inconvenience.

PS: Meanwhile, could you please share your sample .vsdx file which image you had shared earlier as reference.