Adding page from one diagram to another not working properly

Using Aspose.Diagram 22.3.0

When adding a page from one diagram to another, the shapes/objects in the source diagram page isn’t copied over to the destination diagram. Only some items gets added or it’s blank.

Code Snippet:

string dir = Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.FullName;
Diagram floorDiagram = new Diagram(dir + @"Floor Plans v001.vsdx");
for (int i = 0; i < floorDiagram.Pages.Count - 1; i++)
{
    Diagram baseDiagram = new Diagram(dir + @"Base Template v001.vsdx");
    Page page = floorDiagram.Pages[i];
    baseDiagram.Pages.Add(page);
    baseDiagram.Save(dir + $"Base with {page.Name} v001.vsdx", 
    SaveFileFormat.Vsdx);
}

Diagram Samples w/ output results:
Samples.zip (2.3 MB)

@ger.vue

An issue as DIAGRAMNET-52751 has been logged in our issue management system for the sake of correction. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

@ger.vue

The master of the shape is in the floorDiagram. If these masters are missing, the shape will not be displayed, so please add the master to the new diagram.

Please use this sample code:

Diagram floorDiagram = new Diagram("Floor Plans v001.vsdx");
Diagram baseDiagram = new Diagram("Base Template v001.vsdx");
foreach (Master master in floorDiagram.Masters)
{
baseDiagram.Masters.Add(master);
}
for (int i = 0; i < floorDiagram.Pages.Count - 1; i++)
{
Page page = floorDiagram.Pages[i];
baseDiagram.Pages.Add(page);
baseDiagram.Save(dir + $"Base with {page.Name} v001.vsdx", SaveFileFormat.Vsdx);
} 
1 Like