Search code examples
c#commentsvisioaspose

Add comments programmatically to Visio file when all pages in source file contains comments


Hello programming world,

I'm facing an issue, a blocker, and I tend to believe that my problem is a bug of Aspose.

I'm using Aspose library in order to work easily with Visio files. There is a file that has 2 pages and each page has comments. Now, my problem occurs when new comments are added to any of the pages.

Error message: "Item has already been added. Key in dictionary: '/visio/comments.xml.' Key being added: '/visio/comments.xml' ".

This key is used in '[Content_Types].xml' file, but I don't understand why the library would try to add a new key of that type.

Has anyone ever worked with Aspose and has struck this problem ?


Solution

  • @Cristian Stirbe, I have tried your scenario in our environment with the latest version 17.8 of Aspose.Diagram for .NET API and managed to replicate the same error. It has been logged under the ticket Id DIAGRAMNET-51353 in our bug tracking system. I will let you know once it is fixed. This is the source Visio drawing and code: Drawing.vsdx

    [C#]

    // load Visio drawing
    Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
    // get page by name
    Aspose.Diagram.Page page = diagram.Pages.GetPage("Page-1");
    // add comment
    page.AddComment(7.205905511811023, 3.880708661417323, "test");
    // Save drawing
    diagram.Save(dataDir + "AddComment_out.vsdx", SaveFileFormat.VSDX);
    

    I work with Aspose as Developer evangelist.