Free Support Forum - aspose.com

SaveFileFormat.VDX : shapes are overlapping evenif specifing x,y different for all shapes : need solution for this

SaveFileFormat.VDX : shapes are overlapping evenif specifing x,y different for all shapes : need solution for this.

Following is the code to produce the same. I am opening the output VDX file in Visio 2016.

public static void Run()
{

    string dataDir = @"D:\_outputTempDeletable\";

    Diagram diagram = new Diagram();
    Page page = diagram.Pages.GetPage("Page-1");

    diagram.AddMaster(dataDir + "shapes.vss", "Rectangle");

    // ---------fiest shape
    int PageIndex = 0; double width = 2, height = 1, pinX = 4.25, pinY = 7;
    long rectangleId = diagram.AddShape(pinX, pinY, width, height, "Rectangle", PageIndex);

    Shape rectangle = diagram.Pages[PageIndex].Shapes.GetShape(rectangleId);
    rectangle.Type = TypeValue.Shape;
    rectangle.Text.Value.Add(new Txt("First Diagram"));
    rectangle.RefreshData();

    // ---------second shape
    PageIndex = 0; width = 2; height = 1; pinX = 4.25; pinY = 4;
    long rectangleId2 = diagram.AddShape(pinX, pinY, width, height, "Rectangle", PageIndex);

    Shape rectangle2 = diagram.Pages[PageIndex].Shapes.GetShape(rectangleId2);
    rectangle2.Type = TypeValue.Shape;
    rectangle2.Text.Value.Add(new Txt("Second Diagram"));
    rectangle2.RefreshData();

    //diagram.Save(dataDir + "TwoShapesPerfect.vsdx", SaveFileFormat.VSDX); // this shows perfect two seperate rectangles in specified x,y (VSDX)
    diagram.Save(dataDir + "TwoShapesOverlapping.vdx", SaveFileFormat.VDX); // this shows overlapped two shapes (I need solution) (VDX) viewing in Visio 2016
}

@ravisidhu

Thank you for contacting support.

Would you please share the stencil file shapes.vss that you are using with this code snippet, along with generated files as a single ZIP file so that we can try to reproduce and investigate it in our environment. Before sharing requested data, please ensure using Aspose.Diagram for .NET 18.7.

Please find the zip attached having files you may need to check

TestOutputFolderAndVssPath.zip (60.2 KB)

regards
Ravinderjit Singh Sidhu

@ravisidhu

We are unable to reproduce the issue with latest version of the API. We have attached generated files for your kind reference TwoShapes.zip. Would you please try Aspose.Diagram for .NET 18.7 in your environment and then share your kind feedback with us. In case the issue persists, please share generated files with us so that we may investigate further to help you out.

I have checked “TwoShapes.zip”, it has two output generated files. Exactly the same we are able to generate with the same code.
Now you can check both files in visio 2016 how it appears in that. Please see screenshots in attachment. These are view of both files how it is viewing in visio 2016.
You can see that (961.png) .vdx file is showing two shapes overlapped and appears like a single shape in bottom of the page.
It should be two separate shapes as it is showing in another attachment (523.png) view of .vsdx which is also generated with same code.
so .vsdx file is ok in visio and .vdx file has issue of overlapping. I am looking forward for the solution from you.

961.png (23.2 KB)
523.png (23.9 KB)

thank you
Ravinder

One manual method to correct overlapping of shapes in VDX file that I tried and worked is:

Remove by replacing following text from VDX file using text editor:

Open vdx file in text editor and remove these strings from file and save this. Now check in visio. This is showing perfect two shapes in specified x,y.

remove this :>>> F=‘Inh’<<<
remove this:>>> Unit=‘MM’<<<

thank you
Ravinder

@ravisidhu

Thank you for elaborating it further.

We have been able to notice the issue in our environment. A ticket with ID DIAGRAMNET-51501 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

The issues you had found earlier (filed as DIAGRAMNET-51501) have been fixed in this release.