Author Topic: Shape's Name bug?  (Read 4481 times)

0 Members and 1 Guest are viewing this topic.

Mariachi41

  • Newbie
  • *
  • Posts: 3
Shape's Name bug?
« on: August 17, 2011, 04: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.


Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3371
    • Paul Herber's website
Re: Shape's Name bug?
« Reply #1 on: August 17, 2011, 04:14:16 AM »
Electronic and Electrical engineering, business and software stencils and applications for Visio -

https://www.paulherber.co.uk/

Mariachi41

  • Newbie
  • *
  • Posts: 3
Re: Shape's Name bug?
« Reply #2 on: August 17, 2011, 04:21:34 AM »
 ;DThanks a lot

Mariachi41

  • Newbie
  • *
  • Posts: 3
Re: Shape's Name bug?
« Reply #3 on: August 17, 2011, 04: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?
 :-\

aledlund

  • Hero Member
  • *****
  • Posts: 1412
Re: Shape's Name bug?
« Reply #4 on: August 17, 2011, 06: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