Free Support Forum -

Shapes lose styling/structure, after "AddShape" to the page

Hi Support,
I’m using Aspose.Diagram .Net
After “AddShape” to the page, all dropped shapes are losing it’s structure/styling as defined in a stencil.
I’ve tried just two simple method calls :

  1. AddShape with size
  2. AddShape without size and SetSize/SetHeight afterwards
    In both cases I’m getting wrong, but different output.

I’ve attached Stencil with masters and two diagrams output examples (158.0 KB)


Would you please also share the sample code snippet which are using to perform the functionality. We will test the scenario in our environment and address it accordingly.

Hi @asad.ali,

Here is simple implementation that will reproduce the issue. I tried different implementations, but could not achieve the expected result.

    static void Main(string[] args)
        var asposeDiagram = new Diagram();
        var stencilPath = "TestStencil.vssx";
        var masterName = "Data object";

        asposeDiagram.AddMaster(stencilPath, masterName);
        asposeDiagram.Pages[0].AddShape(2, 2, 2, 2, masterName);

        asposeDiagram.Save("TestDrawing.vsdx", SaveFileFormat.VSDX);

Note: all masters from the stencil have similar issue.
It looks like formulas/dependencies of sub-shapes are not triggered.
After manual resizing in Visio, the shape can be normalized in some cases.


Thanks for sharing sample code snippet.

We were able to replicate the issue in our environment using Aspose.Diagram for .NET 19.11 and logged it as DIAGRAMNET-51732 in our issue tracking system for the sake of correction. We will further look into details of the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.