This is the second topic in a series discussing the essential features that make up the Visio application.
Essential Feature: Drawings, Stencils and Templates
In the previous post on Drag and Drop, we mentioned that Stencils were separate documents from the drawing and thus Visio has to make a local copy of a master shape when you drag one onto the page. So what is the difference between a stencil and a drawing? And what about templates?
Actually, there is very little difference between these three types of Visio documents. That's because there is really only one document type in Visio. Drawings, stencils and templates are the same technically. The difference is in the “view” of the document information presented to the user.
Try this: make a simple flowchart by starting from the Basic Flowchart template. Drag some shapes onto the drawing page from the Basic Flowchart Shapes stencil. Save the drawing as MyDrawing.vsd and exit Visio. Now rename the file, changing the extension from 'VSD' to 'VSS'. Reopen the drawing in Visio. What do you see? You should see a stencil with just the master shapes you dragged into your drawing. Close Visio and change the extension to 'VST'. Now what do you see when the file is reopened? You should see your drawing but with a generic filename like Drawing1.
What's going on? Every Visio document has a drawing surface - the page that you drop shapes on. Every document also has a stencil containing masters, called the Document Stencil. The file extension tells Visio whether to open a document showing the drawing surface or the stencil. You can see the Document Stencil for your drawing by choosing File > Shapes > Show Document Stencil. Templates are just like drawings. The only difference is that Visio will open a template as a copy of the original document by default. This explains the change in filename.
Another part of a Visio document is the workspace information. Whenever you save a drawing, Visio records the names of the stencils that were opened with your drawing. These stencil documents are automatically reopened the next time your file is reopened.
Those of you who are familiar with Visio's file format history know that there are now two sets of Visio file extensions. VSD, VSS and VST are the drawing, stencil and template extensions for Visio's binary document format. There is a companion set of VDX, VSX and VTX extensions for Visio's XML document format. The XML document format is a full fidelity peer of the binary format that was introduced in Visio 2002. The XML formats offer an under the hood view of the contents of a Visio document. They allow developers to write programs that build new drawings from scratch or read the contents of a drawing – all without having to launch the Visio application.
Try saving out a drawing as XML and then opening the file in a text editor. You can rename the file to give it a .XML extension and view it in Internet Explorer too. There is a lot of information, but if you dig around you'll find the Masters collection that makes up the Document Stencil and the Pages collection that makes up the drawing. You may even find the workspace information.
We're going to kick off the Visio Insights blog with a series on the essential features that make Visio the popular diagramming application it is today. In each topic, we'll cover the basics from a user's perspective and then dive more deeply into the technical details.
Essential Feature: Drag and Drop
Fifteen years ago a new diagramming product hit the marketplace with a revolutionary way to draw. Rather than construct drawings from geometric primitives such as lines and arcs, Visio offered the ability to drag and drop pre-built shapes. One of the early tag-lines for Visio was Drag, Drop, Done. Making diagrams in Visio is more a matter of assembling than drawing, and this mechanism made diagramming approachable for many people.
So how does drag and drop really work?
The pre-built shapes are called Masters, often referred to as Master shapes. The masters are organized into documents called Stencils. The stencils are displayed on the left side of the drawing workspace inside the Shapes window. To add a shape to the drawing, you drag one of the masters from a stencil to the drawing page.
Behind the scenes Visio does a lot of work to place that shape on the page. A stencil is a separate document from the drawing, so Visio first must copy the master from the stencil to the drawing document. (This operation is generally not visible to the user. If you want to see the masters in the drawing document, go to File > Shapes > Show Document Stencil.) Then Visio creates an instance of the master shape and places it on the drawing page.
If you drag the same master shape out from the stencil again, Visio checks to see if there is already a copy of the master in the drawing document. If the master is already present, Visio skips the copy operation and proceeds to create another shape instance to place on the drawing page. Visio checks a property on the master called the UniqueID to determine if two masters are alike. Whenever you edit a master, the UniqueID changes. Thus it is possible for two masters to have the same name, but Visio will know that the masters are different by their UniqueIDs.
UniqueID lets Visio distinguish between two masters with the same name, but users may have more difficulty telling them apart. To avoid that problem, Visio forces the name of each master within a document to be unique. When you add a different master by the same name to a document, Visio automatically renames the incoming master by appending a decimal point and a number such as Person.1 . There may be a scenario where you want Visio to interpret masters with the same name as being identical, so there is a property on the master that you can set to “Match master by name on drop”.
Why go through all these steps to drop a shape on the page? It ensures that Visio documents are always portable. There are no external references to masters in a Visio document, so you can pass documents around and not worry about missing information. Master shapes are a powerful concept, and we'll have more to say about them in a future post.
Welcome to the Visio Insights web log, authored by members of the Visio Product Team. Our goal is to give you some insights into how Visio works, how you can best use Visio to accomplish your tasks and how others are using Visio in their businesses.
You can expect to find topics covering a wide variety of Visio functionality. We'll post information for End Users, Shape Designers and Developers, and you can view archived posts according to these categories.
We want this blog to be a two-way dialogue between the user community and the product team, so your comments are strongly encouraged. Also you can send us suggestions for future topics by clicking on the Contact link.
This blog is by no means the only source of information about Visio, so let's start by highlighting some of the current resources out there. We don't want to reinvent the wheel here. Our goal is to give you insights.
For end users, there is a wealth information and training on Office Online. You can find lots of help about basic tasks, tips & tricks, tutorials and online courses.
For shape designers and developers, MSDN offers a comprehensive set of documentation, samples and tools to assist you. In particular you can download the Visio SDK, which is essential for developing on the Visio platform.
There is an active community that participates in the Visio Newsgroups as well. This is a great place to ask questions about specific issues you have. This blog will address some of the frequently asked questions from the newsgroups.
For those that need direct assistance, Microsoft Product Support is available to help. Please utilize this resource to get your problems resolved. We are not able to respond to specific problems through this blog. The PSS team is highly trained and best equipped to serve you. IT Professionals may also be interested in the deployment and support resources on Microsoft TechNet.
Finally, we're not the only blog on the block. Here are some blogs authored by Microsoft employees or affiliates:
Eric Rockey - Visio 2007 features
Bill Morein - Data visualization with Visio
Chris Castillo - Visio solutions development
Mai-lan Thomsen Bukovec - General Visio blog (inactive)
Visio MVPs - General Visio blog
VisioJ - Japanese language Visio blog
Of course, that is just a small part of the overall Visio community. There are many Microsoft Certified Partners out there who offer their solutions, services and expertise. There are Visio champions in corporations around the world who evangelize Visio to their teams. There are also a number of enthusiasts out there who delight in helping people utilize Visio.
Visio is a popular application with a large and growing base of users. The community is robust and continues to expand. Now is a great time to increase the level of communication between the product team and the user community. We hope you will participate.
Visio Product Team