Aspose Diagram Java With Decision Shape

Hi Team,

I am new to Aspose products and recently took the temporary license for Aspose Diagram Java API. I need help Decision shape; I tried adding master with “Decision” or “Diamon” master name but none of that is working. Below is the code snippet for the same and error message that i am getting:

Diagram diagram = new Diagram();

String masterName = “Rectangle”;
String decisionMaster = “Decision”;
String connectorMaster = “Dynamic connector”;

diagram.addMaster(masterDataDir + “Basic_Shapes.vss”, decisionMaster);
diagram.addMaster(masterDataDir + “Basic_Shapes.vss”, masterName);
diagram.addMaster(masterDataDir + “Basic_Shapes.vss”, connectorMaster);

Error Message: com.aspose.diagram.DiagramException: Master with name {0} does not present in the template.

@jitushrivastava

Would you kindly share your sample Stencil and Diagram file with us. We will test the scenario in our environment and address it accordingly.

Basic_Shapes.zip (53.6 KB)

Please see the uploaded Basic_Shapes.vss file that i am using as stencil.
Also i hared the code earlier for the same. I am not able to generate the diagram as it throws an exception while adding shape.

String visioStencil = dataDir + “Basic_Shapes.vss”;
long diamondId = diagram.addShape(-5, 10, 2, 2, “Diamond”, 0);

@jitushrivastava

We were able to notice similar issue in our environment and logged it as DIAGRAMJAVA-50696 in our issue tracking system. We will further check it in details and let you know as soon as logged ticket is resolved. Please spare us some time.

We are sorry for the inconvenience.

1 Like

Thanks @asad.ali.

@jitushrivastava

We have found that the master with the name “Decision” is not present in the Stencil file. Also, the shape “Diamond” is not present either. Would you please try removing following line of code:

diagram.addMaster(masterDataDir + “Basic_Shapes.vss”, decisionMaster);

Also, please add shapes other than Diamond in the diagram which are present/supported by the Stencil.

Thanks @asad.ali
Do you know if i can use another stencil that has all the shapes i need like triangle, diamond and other flow chart shapes.
As per our business requirement we have to use these shapes. Can we create our own stencils with all the shapes and use them in our project ?

@jitushrivastava

You can surely use more than one stencil files during generating a diagram. Furthermore, please visit the linked article in order to creater your own master from scratch.

1 Like

Thanks @asad.ali I am able to create stencil and use it to create diagram. please see the attached stencil and generated diagram. also please see the below code that i am using to achieve that. i have another question why the generated diagram is showing the stencil? is there any way can we hide that stencil?diagram_using_stencil.zip (79.0 KB)

@jitushrivastava

Would you kindly share the complete code snippet to generate the similar file that you have shared. We will further test it in our environment and share our feedback accordingly.

@asad.ali Thanks for your reply, i tried it again with different option and it worked :slight_smile: i am happy now…

Thanks for all your help and support.
I need help with 2 things now, one is with sales related question and another one is with Dynamic Connector. can I ask question in the same thread or you want me to log another request?

@jitushrivastava

Thanks for your feedback.

For sales related queries, you may please post it in our Purchase forum. Regarding other inquiry which you mentioned, you can share within this forum thread as well as create a new topic as per your convenience.

Thanks @asad.ali,
My other question is to how can we bring the connectors (Dynamic Connectors) to background. please see the attached diagram where we have multiple shapes and their connectors and some connectors are overlapping the shapes so i would like to put them in background. also please let me know if you need a code for the same otherwise any simple code will help you replicate the same.Connector Overlapping.zip (28.7 KB)

@jitushrivastava

Please try using following code line in order to avoid overlapping of connectors.

diagram.getPages().getPage(0).getPageSheet().getPageLayout().getLineAdjustFrom().setValue(LineAdjustFromValue.ALL_LINES);

In case above suggestion does not help, please share minimized code snippet along with respective output diagram. We will test the scenario in our environment and address it accordingly.

Hi @asad.ali, I tried the code snippet you provided but it doesn’t work.
please see the attached VSD diagram with code that generates this diagram. please let me know if anything else is needed to replicate this issue in your environment. TempClass.zip (31.6 KB)

@jitushrivastava

There are stencil files being used in the code snippet that you have shared. Would you kindly share them as well.

Hi @asad.ali please see the attached stencil for your reference.

stencil.zip (77.4 KB)

@jitushrivastava

We are testing the scenario and will get back to you shortly.

Thanks @asad.ali.
Really appreciate for the kind of support you are providing…

@jitushrivastava

Please try to set connectors to back like following:

diagram.getPages().get(0).getShapes().getShape(41).sendToBack();