Add Comments to Shapes in Visio Drawings using C# and Java

Aspose.Diagram for .NET logo

We are pleased to announce that the new version 17.7 of Aspose.Diagram API is now live. The new version of the API adds a feature to add comments to the Visio shapes and also includes regular bug fixes and enhancements. Please use the following links for downloading Aspose.Diagram for .NET and Java assemblies.

Add Comments to a Visio Shape using C# and Java

The recent version 17.7 of Aspose.Diagram API allows to add comments to any Visio shape in the drawing and the shape-level comments will stay with the shape even if it is moved around. In order to read a comment, click the comment icon beside the shape and the comment will open. In order to close the comment, click on a blank area of the page. Developers can use the following code example to add comments to a Visio shape:


// 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
Aspose.Diagram.Shape shape = page.Shapes.GetShape(12);
page.AddComment(shape, "Hello");
// save diagram
diagram.Save(@"c:\temp\Drawing1.vsdx", SaveFileFormat.VSDX);


// load diagram
Diagram diagram = new Diagram("c:\\temp\\Drawing1.vsdx");
// retrieve page by name
Page page = diagram.getPages().getPage("Page-1");
// retrieve shape by ID
Shape shape = page.getShapes().getShape(12);
page.addComment(shape, "Hello");
// save diagram"c:\\temp\\Drawing1.vsdx", SaveFileFormat.VSDX);

Besides this, the mechanism of retrieving SolutionXML elements and page information from the Visio drawing has been improved. The recent version also comprises a series of bug fixes.  In general, it improves the export of Visio drawings to SVG, VSDX, and image formats as well as preserves the page-level comments on the Visio drawings.

Public API Changes

The following API change in the new version is worth noticing:

  • AddComment(shapeinstance, “comment string”) method is added in the Shape class. It helps to add comments to a shape.

Aspose.Diagram for .NET Resources

The following resources will help you work with Aspose.Diagram for .NET: