Part of what makes Visio so powerful yet so easy to use is the ability to create master shapes that can be dragged onto the drawing page. Each copy of a master inherits the appearance, data fields, and behavior of the master. This article describes how to change masters so all copies are affected.
Have you ever created a custom Visio stencil – a collection of your own unique master shapes – and then created a drawing by dragging masters onto the drawing page? Have you then made changes to the stencil master and wondered why the shapes on the drawing page didn’t change?
Shouldn’t they? Aren’t the instances linked to the master??
The answer is yes – and no.
A bit of Visio terminology before we begin:
-
Master: an object in a Visio stencil
-
Shape: an object on a Visio drawing page (shapes are often created by dragging masters onto a drawing page; they can also be created in other ways but we’re not concerned with those in this article)
-
Stencil: a collection of Visio masters (notice that a stencil contains
masters not
shapes)
-
Document Stencil: a special stencil that contains masters for the shapes contained in a Visio drawing
The mystery behind why changing the properties of a master does not update all of its derivative shapes lies in the existence of the document stencil, and is compounded by the fact that the document stencil is hidden by default whenever you start Visio. Consequently, many people aren’t aware that it even exists, let alone know of the critical role it plays when you want to change one master and have all instances inherit the changes.
Here’s what happens when you drag and drop in Visio...
When you drag a master from a stencil onto the drawing page, Visio creates a copy of the master in the document stencil. When you drag another instance of the same master into the drawing, Visio actually uses the copy in the document stencil to create the next shape instance. In essence, the document stencil contains the working copy of each master that you've used at least once in a drawing.
If you subsequently make changes to the master in the original stencil and drag an instance onto the page, Visio creates a
new copy of that master in the document stencil. You end up with shapes on the page that are linked to two different masters even though you started with only one and then edited it.
In direct contrast, if you edit any of the masters in the document stencil you will be offered the option to "update all instances" derived from that master.
To really understand what is going on you need to open the document stencil.
-
Visio 2003/2007: Select
File>Shapes>Show Document Stencil
-
Visio 2010 and later: In the
Shapes window select
More Shapes>Show Document Stencil; OR put a checkmark in front of
Document Stencil on the
Developer tab (see reference 2 at the bottom of this article for instructions on activating the Developer tab).
With the document stencil window open you'll see the masters for all shapes that are now, or were previously, in the drawing. Now that you can see the document stencil, try the following three tests to understand the relationships between masters and stencils.
Test One – Edit a Master in Your Stencil
-
Open a new drawing and your custom stencil. (If you don’t have a custom stencil but want to create one, select
File>Shapes>New Stencil and drag shapes into it.)
-
Open the document stencil as described above; if it's not empty, delete whatever shapes are there.
-
Drag a master from your stencil onto the drawing page; note that a new master now exists in the document stencil.
-
Drag additional instances of the same master onto the page; note that the document stencil doesn't change.
-
Double-click the master in your custom stencil to open it in an edit window.
-
Change the fill color of the master then close the edit window and save the changes.
-
Drag an instance of your modified master onto the page; note that there is now a second instance of your master in the document stencil.
At this point, you can see that changes you make to your stencil masters do not affect shapes that are already on the drawing page.
Test Two – Edit a Master in the Document Stencil
-
Open the document stencil for an existing drawing.
-
Change the fill color or other attributes of a master in the document stencil; be sure to pick one that you know has instances on the drawing page.
-
When you save the changes to the master, you will see a dialog asking whether you want to update all instance of that master.
-
Click Yes; note that all instances of the edited master on the drawing page now reflect your master’s new attributes.
It should now be clear that making changes to the masters in your custom stencil does not affect shapes already on the drawing page (Test One) but that editing masters in the document stencil does alter drawing page shapes (Test Two).
But what if you edit a shape instance on the drawing page and then subsequently edit its master?
Test Three – Edit a Shape Instance and its Master
-
Change the fill color of a shape on the drawing page
-
Double-click the master in the document stencil that corresponds to the shape in the previous step.
-
Change both the fill color and the line color of the master; be sure to use different colors than any you’ve used so far.
-
Save the master changes and click Yes when asked whether to update instances.
The result of Test Three is that the shape on the drawing page retains its unique color but it inherits the new line color from the updated master. What’s happening here is that the edited instance on the drawing page is still linked to the master in the document stencil, however, when you edit an attribute in a shape you break the link for that specific attribute.
Conclusion
As are result of the tests above we can see that:
-
Making changes to a master in a stencil does not affect any drawing page shapes that were derived from that master.
-
Making changes to a master in the document stencil gives you the option to apply the changes to all derived shapes.
Conclusion #1 is the biggest source of confusion for people who create custom masters – it’s the opposite of the behavior they expect.
Conclusion #2 makes sense – once you know of the existence of the document stencil.
A final note: At the conclusion of Test Two above, you have updated a master in the document stencil along with its instances on the drawing page. You have not updated the master shape in your original custom stencil. If you want the changes you’ve made to become permanent for all new instances that you drop onto the page, drag the updated master from the document stencil to your custom stencil and delete the original, unchanged master.
References
1) About the document stencil:
http://office.microsoft.com/en-us/visio/HP850514121033.aspx
2) Displaying the Developer Tab in Visio
https://support.microsoft.com/en-us/office/show-the-developer-tab-e1192344-5e56-4d45-931b-e5fd9bea2d45
Comments (1)
Commented: