Visio Guy

Visio Discussions => Visio Bugs (er...Issues) => Topic started by: Mariachi41 on August 17, 2011, 09:07:29 AM

Title: Shape's Name bug?
Post by: Mariachi41 on August 17, 2011, 09:07:29 AM
I use C# to open a .vsd file and get shapes on one page. When I debug my code I find a problem, some shapes' Name property in the code is different from that I saw in the Format->Especial->Name. For example, one server shape's name is "server" in visio, but in the debug mode, it's "Sheet.2". This situation only appears in the "Net" template's shapes, and in other templates such as "Basic Flowchart", the code works well.

Anyone can help me with this? Thanks a lot.

Title: Re: Shape's Name bug?
Post by: Paul Herber on August 17, 2011, 09:14:16 AM
It's the age-old Name/NameU problem; this might help
http://visguy.com/vgforum/index.php?topic=2709.0 (http://visguy.com/vgforum/index.php?topic=2709.0)
and this
http://blogs.msdn.com/b/visio/archive/2006/07/27/679625.aspx (http://blogs.msdn.com/b/visio/archive/2006/07/27/679625.aspx)
Title: Re: Shape's Name bug?
Post by: Mariachi41 on August 17, 2011, 09:21:34 AM
 ;DThanks a lot
Title: Re: Shape's Name bug?
Post by: Mariachi41 on August 17, 2011, 09:42:43 AM
Dear Paul:

    I'v read the topics you gave, but I found my problem is different. Firstly, I only use default master of "Net" template; Secondly, in debug mode, I use a for cycle the get all the shapes, only the first shape's Name and NameU are normal, others' Name and NameU are both Sheet.X (X begin from 2).

    I've read Microsoft help document,  "If the shape is not an instance of a master, shapeName is Sheet followed by the shape's ID number. For example, Sheet.34. In this case, the Name and NameID properties of the shape return the same string." But I drag the shape from default stencil. So, WHY?
:-\
Title: Re: Shape's Name bug?
Post by: aledlund on August 17, 2011, 11:48:36 AM
when you drop a shape on a page, visio will assign a default name to the object. The default name uses the form sheet.xx where xx is a number that is incremented, i.e. sheet.35 was dropped on the page after sheet.34. The number is the Id number, sheet.id... After the object is on the page you get the option (via code) to rename the object using Name and NameU.
al