Using the current latest Aspose.Diagram version, v24.6.0.
Having an issue where changes made to a copied page are also affecting the original page. Please fix this bug or help me disassociate the copied data from the original. Thanks!
Here’s the test code snippet:
Page pgSoure = diagram.Pages.GetPage(0);
Page pgCopy = null;
int currMaxID = 0;
foreach (Page page in diagram.Pages)
{
if (page.ID > currMaxID)
{
currMaxID = page.ID;
}
}
pgCopy = new Page(++currMaxID);
pgCopy.Copy(pgSoure);
diagram.Pages.Add(pgCopy);
for (int i = 1; i <= 3; i++)
{
Shape shape = pgCopy.Shapes.GetShape($"text.{i}");
if (shape != null)
{
ChangeText(shape, $"New Text {i}");
}
}
diagram.Save(Path.Combine(OutputPath, FileName), SaveFileFormat.Vsdx);
Here’s the code snippet for ChangeText():
private static void ChangeText(Shape shape, string text)
{
foreach (FormatTxt txt in shape.Text.Value)
{
if (txt is Txt tx)
{
tx.Text = tx.Text.Replace(tx.Text, text);
break;
}
}
}
Include sample diagram and its outputted diagram.
TestDiagram.zip (20.0 KB)