Setting Shape Data

I'm trying to set a string value for Shape data, but when I open the file in Visio, it complains about being the wrong data type and resets it to 0.

var prop = new Prop();

prop.Type.Value = TypePropValue.String;

prop.Name = "EmployeeId";

prop.Value.Val = "NUM123456";

shape.Props.Add(prop);

Why doesn't this work? Additionally, I have this data field in the master shape, but when a shape is created from it, it doesn't have any properties in the Props collection, so I have to add them manually as above.

Hi,

At the moment Aspose.Diagram for .NET successfully sets number values only (e.g. prop.Value.Val=“123456”:wink: while creating a new property.

This issue has been logged into our issue tracking system as DIAGRAM-33167. We will keep you updated on this issue in this thread.

In the meantime, you can copy properties from an existing shape as you can see in the following code.

foreach (Shape masterShape in sourceDiagram.Pages[0].Shapes)
{
    if (masterShape.Name == "Star 7")
    {
        foreach (Prop property in masterShape.Props)
        {
            shape.Props.Add(property);
        }
    }
}

Please feel free to contact us in case you have further comments or questions.

Best Regards,

The issues you have found earlier (filed as DIAGRAM-33167) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.