Hi we recently purchased the library . It seems to have good capability and we are excited .
We need an assistance on how to set custom properties to drawn shapes in java.
Is there any code sample we can refer to ?.
Well the main problem we face is we were able to add the property but the values dos not show up
Prop prop4 = new Prop();
prop4.setName(“ip_flagN”);
prop4.getLabel().setValue(“IP flagL”);
prop4.getValue().setVal(“IPFLagV”);
shape.getProps().add(prop4);
the property is added but the prop4.getValue().setVal(“IPFLagV”); does not show the value on the window.
Thank you.
Would you kindly share your sample Diagram file along with complete sample code snippet that you have tried so far. We will test the scenario in our environment and address it accordingly.
We were able to notice the issue in our environment and logged an investigation ticket as DIAGRAMJAVA-50690 in our issue tracking system for further investigation on this scenario. We will look into scenario details and share our feedback with you as soon as ticket is resolved. Please spare us little time.
Hi May I know the estimated time to resolve this issue . We have a time sensitive implementation of the library to a project can you kindly let me know how long it would take.
I also would like to check if there will be any limitation on the number of properties we can add on shape.
I can add the name but the value does not display.
We have investigated the ticket and as per the results, please use following code snippet to read the properties of Shape which you added:
for (com.aspose.diagram.Shape eshape : (Iterable<com.aspose.diagram.Shape>) dg.getPages().getPage(0).getShapes()) {
for(int i= 0;i<eshape.getProps().getCount();i++) {
// Display information about the shapes
System.out.println(i);
System.out.println(eshape.getProps().get(i).getValue().getVal());
}
}
Please note that Aspose.Diagram mimics the behavior of MS Visio and supports similar features. In case you face any issue, please feel free to let us know.
Hi thank you for your response but the problem I had was , to add the properties and display them in the visio.
Can you please assist me on that , how can you add the properties and display them?
Is there any limit on the number of properties ?
if you see my code above I added the properties but they don’t display on visio .
visio.zip (938.6 KB)
I have added sample stencil and out put Diagram file , can you please help us add the properties of the shapes from the program .
and we do not expect any limitation on the no of properties to be added as per Visio diagram
Please note that there is no limit on the number of properties to be added to Shape using Aspose.Diagram. In order to see the properties in MS Visio, please open the developer options, and you will find the properties. Please check the attached image.
Adding more to our previous reply, your earlier shared code snippet was correct to add the properties. Furthermore, if you are facing some issue while adding any property to your diagram, please let us know.
Dear Asad.ali, thank you very much for your assistance , I tried the property value as you mentioned above. here is a sample code I tried.
if (shape == Server2) {
Prop prop2 = new Prop();
prop2.setName(“Entity_Type”);
prop2.getLabel().setValue(“Server”);
prop2.getValue().setVal(“epaysql_ut.mbc.com”);
Prop prop3 = new Prop();
prop3.setName("Hostname");
prop3.getLabel().setValue("Host Name");
prop3.getValue().setVal("Controler");
Prop prop4 = new Prop();
prop4.setName("ip_flag");
prop4.getLabel().setValue("System Data Center");
prop4.getValue().setVal("IPFLagV");
Prop prop5 = new Prop();
prop5.setName("Indicator");
prop5.getLabel().setValue("Flag");
prop5.getValue().setVal("mbc");
Prop prop6 = new Prop();
prop6.setName("Priority");
prop6.getLabel().setValue("Priority");
prop6.getValue().setVal("6");
shape.getProps().add(prop2);
shape.getProps().add(prop3);
shape.getProps().add(prop4);
shape.getProps().add(prop5);
shape.getProps().add(prop6);
}
Only the last property that has numeric value is getting displayed properly, but the rest of them with string value are displayed as 0 value, which is not what I added .
Is there any formatting that we have to use to add string value ? as I can see the method accepts string argument even the numeric value is added inside double quote .
I have seen in some of the discussion in the forum the following method being used .
prop2.getFormat().setValue(" xxxx") is it something I have to use ?
if so how do I use it ?
Is there any documentation that I can use for a reference in the future when using the methods in the library.
for example we would like to try check the compact tree drawing as well is there any library documentation we can access ?
I have attached the screen shot of the above code out put. Property_Mapping.PNG (3.1 KB)
Hi Asad Ali ,
Thank you for your support , I have attached the stencil and the diagram generated by the above code snippet.
Please kindly help us get this thing resolved as soon as possible. We have a time sensitive project where we would like to use the library .
Can you please help me get also a referral document about the API’s.Drawing.zip (760.5 KB)
Hi again, I used connector shape from visio two connect to shapes and I added a text on it.
The text is centered on the connector icon.
how do I move the connector text position
connectors.get(counter2).getText().getValue().add(new Txt(" depends")
the above line adds text on the connectors shape but I want change it position from center to beginning