Cannot get shape name of a shape inside of a shape

Good afternoon,

I am trying to get a shape name or a NameU for a shape located inside of a shape. If I look in the “MasterShape” object I am able to see the name but in the actual shape itself.

In the first screen shot “NoName” you can see the Name and NameU field is blank.
In the second screen shot “NameWork” you can see the Name and NameU field have the correct names and those are in the Master Shape.
It seems that the Master shape does contain the Name fields but the shapes that are added to the diagram do not contain the name fields. Do you know if there any property I am missing or is there something I need to set on the stencil? Thanks in advance.

Hi Blake,


Thank you for contacting support. Please note that the Shape class has “Name” and “NameU” properties. The Master and Shape names are two different properties. Please refer to this help topic: Retrieve Visio Shape Information

In case this does not help, then please provide us your sample code and source Visio here for testing purposes. We’ll investigate and reply you appropriately.

Hello I was still not able to fix my problem.

I have uploaded all the required files to this location:

https://drive.google.com/file/d/0B55ng_gJUbDqRU9HYXQ3Qm5iT1E/view?usp=sharing

After you unzip the folder you will see a folder called “xmlANDstencil” please take the two files out of that folder and place them in the root of your C drive.

Then you can open the “XmlToVisio.sln” solution. Then please set a break point on line 632. Next you can debug the application. Once the browser has loaded up please add this to the localhost url “/api/values” and you will then hit the break point in Visual Studio. Once the breakpoint is hit you can hover the mouse over the word “Shapes” and choose the first shape in the array. You will notice that both Name and NameU are blank. This is where I am having my problem. Those fields should have the Name and NameU. On the same shape you can open the “MasterShape” and you will notice the Name field is correct. The stencil is called MasterAdd.vss and does have the Name fields in it.

Thank you so much for your help. Please let me know if you have any questions or problems I can help with.

Hi Blake,


Thank you for supplying a sample project and the source documents. We’re not able to debug code line number 632 because when we navigated to “/api/values”, it throws an error while reading the “xmlsample.xml” file.

Line 31
Code: XDocument doc = XDocument.Load(@“C:\AD\test567\xmlANDstencil\xmlsample.xml”);
Error message: "Additional information: Invalid character in the given encoding. Line 11, position 1."

Anyway, please note, when you’ll drag and drop a Visio shape using Microsoft Office Visio, it places a Visio shape in the diagram and also copy master name in the shape name field. You are not setting the specific shape name in the code and Aspose.Diagram API also keeps this property empty. Since the shape name will be the same as you can get using “ShapeObj.Master.Name” property. However, you can distinguish shapes of a same type by NameU property, shape id and type property. Aspose.Diagram API sets NameU field as “MasterName.someindex” but unfortunately in your screenshot NameU field is also empty. Please recheck the XML file and supply it again in this forum thread. It would be great if you can also please simplify the code (remove unnecessary lines of code).

Thank you for the quick response. I have tested the new xml and attached it and it should no longer throw an error. Sorry for the extra code but at this moment I am unable to remove any of it. I can tell you the shapes are added on line 446. I can help in with any other information you may need. It is very strange that the nameu property is not populated. Is there any other way I can write to the shape name or nameu property after the shape has been placed on the diagram?

Hi Blake,


Thank you for supplying an updated XML file. We managed to replicate the problem of empty Name and NameU fields. It occurs when you’re retrieving sub shapes of the “OR” group shape.

Sample code of the use case is as follows:

[.NET, C#]
// load a Visio diagram
Diagram diagram = new Diagram();

// Add master with stencil file path and master name
diagram.AddMaster(@“C:\AD\test567\xmlANDstencil\MasterAdd.vss”, “or”);

long shapeid = diagram.AddShape(5, 5, “or”, 0);
Aspose.Diagram.Shape OrShape = diagram.Pages[0].Shapes.GetShape(shapeid);
foreach (Aspose.Diagram.Shape subshape in OrShape.Shapes)
{
if(subshape.Type == TypeValue.Group)
foreach (Aspose.Diagram.Shape childSh in subshape.Shapes)
Console.WriteLine(childSh.ID + childSh.Name + childSh.NameU);
}
However, when we saved the resultant drawing in the VDX and then opened it using the Microsoft Office Visio, it shows Name properties e.g. input1, input2 ... output by ungrouping manually. We've logged this problem under ticket id DIAGRAMNET-50672 in our issue tracking system. Your post has also been linked to this issue. We'll keep you informed regarding any available updates. We're sorry for the inconvenience caused.

Thank you for looking into this. I will keep an eye out for an update.

Hi Blake,

Thank you for being patient. We have a good news for you that the issue id DIAGRAMNET-50672 has now been resolved. If there is no issue in the QA phase, then this fix will be included in the next version of Aspose.Diagram for .NET 6.1.0. We'll inform you via this forum thread as soon as the new release is published.

That is great news. Thank you so much for your help with this.

Hi Blake,


You are welcome. Please feel free to ask if you have any other question in reference of the Aspose.Diagram API, we will be happy to help you.

Hello,

I was wondering if there is any estimate on when the next release will come out?
Is it normally the end of the month? Thanks.

Hi Blake,


Thank you for contacting support. We normally release each version with a gap of one month. So roughly the next release will come out at the end of this month. We’ll let you know once it is published and available for the public use.

The issues you have found earlier (filed as DIAGRAMNET-50672) have been fixed in Aspose.Diagram for .NET 6.1.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.