|Microsoft Office Visio® 2003
||This article was excerpted from Microsoft® Office Visio® 2003 Inside Out by Mark H. Walker and Nanette Eaton, Chapter 21, "Customizing Shapes and Solutions." Visit Microsoft Learning to buy this book.
When you create or customize a template, you set up a reusable environment that includes one or more drawing pages, the page settings you require, and the stencils that you want to make available. The simplest way to create a template with custom settings is to open a drawing, choose the page settings and stencils you want, and then save everything as a template (.vst) file. It's no more complicated than that.
Most Visio templates open with a blank drawing page, but you can create a template that already includes shapes. For example, you can save a border and title block on the drawing page and then save the drawing as a template. Or you can add your company logo to a background page and then save the file as a template so that the logo will appear on each page of a diagram created with that template, as Figure 1 shows. People typically create their own templates when they want a convenient way of opening several frequently used stencils together, or when they want to save custom page settings and window positions.
Figure 1. You can save the settings and shapes you use most as a reusable template.
You can save any Visio file as a template. When you save the file, you're also saving the file's page settings, print settings, style definitions, Visual Basic for Applications macros, color palette, layers, window sizes and positions, and snap and glue options. Make sure to specify the options you want in your template, because those are the options that will appear as the defaults in any diagram based on that template.
The default location to which Visio installs template files is C:\Documents and Settings\user\My Documents\My Shapes, where user is the user log-on name used when starting Microsoft Windows. However, you can specify other paths with the Options command (Tools menu, Options, Advanced, and then click the File Paths button). You can subsequently open the template by clicking Open on the File menu and then browsing to the template's location. The user-created template will also show up in the Other folder on the Visio 2003 startup screen.
To create a template from a drawing file or an existing template, follow these steps:
- Open a drawing (.vsd) file, or start a new drawing based on the template you want to modify.
- Open the stencils you want to save with the template.
- Insert pages, if you want, and specify the drawing page settings you want to use in all diagrams based on this template.
For example, on the File menu, click Page Setup to specify the page size and drawing scale.
- If you want the template to include open windows automatically, display the windows you want.
For example, choose View, Pan & Zoom Window to have the Pan & Zoom window open every time you start a drawing with the template.
- When you've added the settings you want, on the File menu, click Save As.
- In the Save As Type list, select Template (*.vst).
- Type a file name for your template and specify a location.
- Click the Save button's drop-down arrow, and verify that the settings you want are selected.
By default, Workspace is selected, which means that Visio saves the size and position of all the open windows with the file's other contents. The Read Only option isn't necessary unless you really don't want anyone to be able to open the original template file — an error will appear if you try to open the original version of a template saved as read-only.
- Click Save to create the template file in the specified location.
Adding stencils to a template
Your template can include stencils that Visio opens in the default fashion: as docked windows in the Shapes area of the Visio window. However, if you prefer working with stencils in a different location, or with some stencils docked and others floating, you can do this in your template, as Figure 2 shows. When you're creating your template, all you have to do is arrange the stencils in the way you want them to open. As long as you save the template file and its workspace list (the default behavior when you save), the stencils will open as specified when you start a drawing based on your template.
Figure 2. Visio saves the position and size of the open windows in your template as part of the file's workspace list.
If you're saving stencil and template files that are meant to work together, make sure that their styles and colors are compatible. Because stencils are separate Visio files that the template file opens, the inheritance rules in Visio apply when shapes are dragged between files. Odd complications can arise if you've used a color theme or styles for your masters that are different from the settings in your template. Recall that the style and color settings are saved with the file, so for masters, that means the settings are saved with the stencil file. The template file can have different settings that can override those specified by the stencil.
For example, if a master shape is formatted with a custom style, that style is saved with the stencil file. If you include that stencil file in a template, but the template doesn't include the same style, Visio adds the style to the template when the master is added to the drawing page. No problem. But what if the template file also has a style of the same name? Perhaps the Normal style in the stencil file specifies 8-point Arial type and the Normal style in the template file specifies 12-point Arial type. When you add the shape, the style will inherit the characteristics of the style from the drawing page, which inherited the template's settings.