We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Page.Copy() doesn't copy over Developer's changes

Using Aspose.Diagram v21.12

Each shape objects in my diagrams have a unique name assigned to them in the Developer tab, Shape Name. It’s so I can mapped the object programmatically and do whatever I need to do with it base on logic. When using Page.Copy() to try and duplicate the page, all of the configurations done in the Developer tab are gone and set to default.

Can you fix it so it’ll duplicate all the data the object have in the original copy, including edits done in the Developer tab?

@ger.vue

Could you please share your sample source Diagram along with complete sample code snippet so that we can test the scenario in our environment and address it accordingly.

Diagram Sample:
DemoDiagram.zip (200.4 KB)

I have three rectangle and changed the shape name for each of them.
image.png (54.1 KB)

Code Snippet:

static void Main(string[] args)
{
    string dir = Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.FullName;
    string filename = "\\DemoDiagram.vsdx";
    
    Diagram diagram = new Diagram(dir + filename);
    
    // Get page object
    Page SrcPage = diagram.Pages[0];

    // It calculates max page id
    int max = 0;
    if (diagram.Pages.Count != 0)
        max = diagram.Pages[0].ID;
    for (int i = 1; i < diagram.Pages.Count; i++)
    {
        if (max < diagram.Pages[i].ID)
            max = diagram.Pages[i].ID;
    }

    // Set max page ID 
    int MaxPageId = max;

    SrcPage.BackPage = null;
    Page newPage = new Page(MaxPageId + 1);
    newPage.Copy(SrcPage);
    newPage.BackPage = diagram.Pages.GetPage("Border");
    newPage.Name = "CopyPage";
    diagram.Pages.Add(newPage);

    diagram.Save(dir + "\\OutputDiagram.vsdx", SaveFileFormat.Vsdx);
}

CopyPage shapes name should be “DemoBox#”, but instead it reverted back to default name “Rectangle.#”.

@ger.vue

We have logged an issue as DIAGRAMNET-52506 in our issue tracking system for further investigation. 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
Please try the latest fix 21.12.1. We have fixed this issue in this hotfix.
Aspose.Diagram21.12.1.zip (6.8 MB)

Thanks.

The issues you have found earlier (filed as DIAGRAMNET-52506) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou