Add annotations for shape or other object

Hi, Aspose team!
I found how to add comment to comment to page (
Working with Comments|Documentation)

Now question is how can I add comment(annotation) for shapes on page? I
I can not understand how the comment relates to shape. When I create a comment on a shape in visio and then open the document on the Aspose diagram, I can not understand how Aspose.Diagram refers to the comment on the shapeand how to add a comment to a shape that has no comment.
Sincerely, Vlad.

Hi Vlad,

Thank you for contacting support. There is no way to add comments to a shape in the drawing. We have logged a feature request under the ticket ID DIAGRAMNET-51274 in our issue tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates. We are sorry for the inconvenience caused.

Thanks for your reply.
I think to fix this problem for myself with a callout with text. But when I add a callout as a shape from another document to my document, the callout becomes an ordinary shape. If I add a master with a shape from another document to my document, and after that I add the shape to this master, an exception appears in the new document that says the collection has been changed. The exception does not say which collection was changed. What am I doing wrong?
Here is the image, as I add the master and form. Also there is information about the exception.
image.png (25.6 KB)

Sincerely, Vlad.

Hi Vlad,

Thank you for the inquiry. We managed to replicate this error in our environment. It has been logged under the ticket ID DIAGRAMNET-51275 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates. We are sorry for the inconvenience caused.

As a workaround, please do not retrieve a shape instance from the Master. You can initialize a new shape instance, as a first parameter of the AddShape method as below:
diagram.AddShape(new Shape(), masterName, 0);

Thanks & Regards,
Imran Rafique

@Vlad94,
Thank you for being patient. The ticket ID DIAGRAMNET-51274 has been resolved. If there is no issue in the quality assurance phase, then this fix will be included in the next version 17.7 of Aspose.Diagram for .NET API. We will notify you as soon as the new release is published.

In reference to the ticket ID DIAGRAMNET-51275, please do not add the same mastershape using addshape. Please try this sample code:
[C#]

//Shape shape = diagram.Masters.GetMasterByName("Rectangle").Shapes[0];
Shape shape = new Shape();
diagram.AddShape(shape, "Rectangle", 0);

or use this code:
[C#]

diagram.AddShape(1, 1, "Rectangle", 0);

We have closed the already logged ticket ID DIAGRAMNET-51275.

Best Regards,
Imran Rafique

1 Like

Hi, Aspose!

I have a problem when I trying to set a width for shape. I import the master with the shape from document “SimpleDoubleArrow.vss” into my new document created with Aspose.Diagram. But when I import master and shape into a new document, and after that saved the document, as a result, I got a shape that has a wrong form. Why did this happen?
I send you the documents “SimpleDoubleArrow.vss” and the result that I received.

Thank you for attention.

Best regards, Vlad.
For Aspose2.JPG (1.1 KB)
For Aspose.JPG (1.4 KB)

SimpleDoubleArrow.zip (10.6 KB)

@Vlad94,
We managed to replicate the problem of incorrect shape’s display (OutputVSDX.zip (10.8 KB)
). It has been logged under the ticket ID DIAGRAMNET-51287 in our bug tracking system. We linked your post to this ticket and will keep you informed regarding any available updates.

The shape display is not same as we can see in your snapshot, so we recommend to share the complete code as well because it will help us to replicate the actual use case.

@Vlad94,
Thank you for being patient. In reference to the ticket ID DIAGRAMNET-51274, please download and try the latest Hotfix version 17.6.1 of Aspose.Diagram for .NET API (download link: Aspose.Diagram for .NET 17.6.1) and let us know how that goes on your side.

[C#]

// load diagram
Diagram diagram = new Diagram(@"c:\temp\Drawing1.vsdx");
// retrieve page by name
Aspose.Diagram.Page page = diagram.Pages.GetPage("Page-1");
// retrieve shape by ID
Shape shape = page.Shapes.GetShape(12);
page.AddComment(shape, "Hello");
// save diagram
diagram.Save(@"c:\temp\Drawing1.vsdx", SaveFileFormat.VSDX);

Best Regards,
Imran Rafique

@imran.rafique,
Thanks for the answer. I tried to use Aspose.Diagram for .NET 17.6.1 to solve the problem of adding a comment to the shapes. I’m happy to report that everything works as written in your example. I express my gratitude to you for attention to my problem.

Can I ask you another question? When I used the AddComment method, the parameters for the calling method are “double pinX”, “double pinY” and “string comment”. But when I write the code: “diagram.Pages [0] .AddComment (1, 1,” test "); Comment added to the upper left corner. Even if I write the coordinates for comments in the center of the document, the comment will be in the upper left corner.
Also, the comment, that was added by the AddComment method, does not display text and does not exist in the visio document annotation area.
Why is this happening?

Best Regards,
Vlad.
here visio document with comment.zip (26.2 KB)

@Vlad94,
Thank you for the appreciation. It is the default behavior of Microsoft Visio 2013 and 2016 applications that when you add a comment to a page, the comment icon will appear in the upper left corner of the page. However, when you add a comment to a shape it is actually attached to the shape and moves with the shape. In reference to the invisible text of a comment, we have logged a ticket ID DIAGRAMNET-51289 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

Best Regards,
Imran Rafique

@Vlad94,
The ticket ID DIAGRAMNET-51289 has been resolved. If there is no issue in the quality assurance phase, then this fix will be included in the next version 17.7 of Aspose.Diagram for .NET API. We will notify you as soon as the new release is published.

Best Regards,
Imran Rafique

Thanks for the answer.
I’m looking forward to the new update of your product.

Regards,
Vlad.

The issues you have found earlier (filed as DIAGRAMNET-51274) have been fixed in Aspose.Diagram for .NET 17.7. This message was posted using BugNotificationTool from Downloads module by imran.rafique

The issues you have found earlier (filed as DIAGRAMNET-51289) have been fixed in Aspose.Diagram for .NET 17.7. This message was posted using BugNotificationTool from Downloads module by imran.rafique

Hi, Aspose team ! I have some questions about the comments in Aspose.Diagram. I use Aspose.Diagram 17.8 and I use the AddComment method to add a comment to the shape. But I can not find the methods or parameters of this comment to add information to the author who added this comment. Can you tell me, please, how can I add information about the comment?

@Vlad94,
Each comment stores and displays the name of the comment author and the date on which it was created. Microsoft Visio application stores the user name of operating system as an author. In the same way, Aspose.Diagram API mimics the behavior of the Microsoft Visio application. Kindly let us know in case of any further assistance or queries.

Thanks for the answer.
I can not understand how to edit or add information about the comment’s author, which I added using the AddComment method. Can you show me how I can do this?

Regards,
Vlad.

@Vlad94,
There is no way to edit the author name of the comment. As we said in the previous reply, Microsoft Visio application stores the user name of the operating system and does not allow users to edit it. Aspose.Digaram API mimics the behavior of the Microsoft Visio application.

Hi, Aspose team ! I have some questions about the comments in Aspose.Diagram. I use Aspose.Diagram 17.8 and I use the AddComment method to add a comment to the shape. How can I find comments that have been added to the shape? For example, I added three comments for three shapes. The annotation list contains three annotations that are created after adding comments to the shapes, but the annotations do not refer or contain information about the shapes to which they were added.

Thanks, Vlad.