I’ve tried everything so far to try and insert an image into a visio doc. All of the examples you currently have for images is replacing the shapes and then setting their values such as:
for (Shape shape : (Iterable) newDig.getPages().getPage(0).getShapes()) {
// Filter shapes by type Foreign
x = shape;
if (shape.getType() == TypeValue.FOREIGN) {
// replace picture shape
shape.getForeignData().setValue(imageData);
}
}
However I would like to insert an image into the doc as a shape from scratch and not simply replace shapes. The problem that I encounter is that this image does not have a master or at least I can't find an appropriate master.
Could you provide me with a code example of how I create a shape from lets say
Hello Imran,
I am also dealing with same issue. I want to insert in image that fits into rectangle shape. I have used your code mentioned above but its not working for me. Following exception occured:
com.aspose.diagram.DiagramException: Master with name {0} does not present in the collection of Masters.
at com.aspose.diagram.gv.a(Unknown Source)
at com.aspose.diagram.Page.b(Unknown Source)
at com.aspose.diagram.Page.addShape(Unknown Source)
at com.test.DynamicConnector.main(DynamicConnector.java:57)
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.