Rahul Vishwakarma
Rahul Vishwakarma

Reputation: 996

How to know for which Master a Visio shape belongs to

I am having difficulty in finding out the master shape for a Visio shape. Suppose if I drag a Shape named 'Start Shape' from a Stencil to a document then Visio will create an instance for shape 'Start Shape' on the Document.

Now I can access the shape name using Name/NameU of the shape property, but using Name property I got name as 'Start Shape.12'

I need to find out the master shape name i.e 'Start Shape' from which the dropped shape is created. In the above case 'Start Shape'

Upvotes: 2

Views: 4370

Answers (2)

Nikolay
Nikolay

Reputation: 12245

Note that when you drop a master (shape) from a stencil, Visio creates a local copy of that master in the drawing (you could make those visible using the "Drawing Explorer" window). So when you refer to shape.Master you actually get a reference to that copy.

That means, if later you change the master shape in the stencil, and drop it one more time, you may get another local master (again with suffix). This also means that if you rename a master in a stencil, your local master (and thus Shape.Master.Name) will stay unchanged.

To get an "exact" source (if you need to) you may take a look at the "BaseID" and "UniqueID" properties of a master which may be helpful to figure out what was the original master in case it was modified.

Upvotes: 3

Rahul Vishwakarma
Rahul Vishwakarma

Reputation: 996

I solved the problem, through Shape.Master.Name property we get the Master Shape Name.

Upvotes: 2

Related Questions