Creating Templates

In general, to create a Microsoft® Visio® template, you open a new or existing drawing file, set options you want, open the stencils you want, and then save the file as a template.

A template can provide shapes already on the drawing page, but more importantly it can set up the drawing page with a uniform grid and scale and include specific styles and layers. A template can also open one or more stencils. When the user creates a drawing based on a template, Visio opens the stencils and creates a new drawing file, copying the template's styles and other properties to the new file. As with the stencil, once the user creates the drawing, he or she no longer needs the template.

The drawing page of a template file is typically blank, but you can choose to include shapes on the drawing page, such as a title block or a company logo, or your template may contain multiple drawing pages.

In this section…

Creating a Template

About Pages, Backgrounds, and Layers

Creating a Template

You can save any Visio file as a template, and templates can include the following elements:

  • A workspace list identifying one or more stencils, which are opened when you open a new drawing file with the template
  • One or more drawing pages, including backgrounds; each page can contain a drawing and can use a different size and scale
  • Microsoft® Visual Basic® for Applications (VBA) macros
  • Print settings
  • Styles for lines, text, and fill
  • Snap, glue, and layering options
  • A color palette
  • Window sizes and positions

Typically, when you open a file as a template (.vst or .vtx for a template in XML format), you open at least two documents, a stencil file and a drawing file, which contain the elements shown.

Typically, when you open a file as a template (.vst or .vtx for a template in XML format), you open at least two documents, a stencil file and a drawing file, which contain the elements shown.

  1. One or more stencils, if specified in the template's workspace list
  1. Style definitions and colors used in the stencil file, which should match those of the drawing
  1. The template's workspace list, which specifies all the files and windows to open
  1. The drawing, which can have more than one page, and includes its own style definitions, color palette, and document stencil

To create a template

  1. Open the drawing file on which you want to base the template. Or open a new drawing file.
  1. Open the stencil file (or files) that you want to open with the template.
  • Open each stencil file as
  • Read only
  • . If you open the stencil file as
  • Original
  • , it will be saved that way in the template's workspace list.
  1. Activate the drawing window, and then change or define options and settings that you want to include in the template.
  1. If you want a drawing page to contain any standard elements, create the appearance you want. You can insert additional pages as either foreground or background pages.
  1. Click Properties on the File menu. In the Properties dialog box, type information about the template, and then click OK.
  • The text you type for
  • Description
  • appears when you pause your mouse pointer over a template icon in the
  • Choose Drawing Type
  • pane or over the name of a template in the file list in the
  • Open
  • dialog box.
  1. On the File menu, click Save As.
  • Click the arrow next to the
  • Save
  • button, and then click
  • Workspace
  • . In the
  • Save as type
  • list, click
  • Template (*.vst)
  • or
  • XML Template (*.vtx)
  • . In the
  • File name
  • box, type a name for the template, and then click
  • Save
  • .

Visio typically opens a template's stencils in anchored windows that are docked and read-only. However, a template can open some stencil files docked and others floating, some as read-only and others as original. A template's workspace list stores the names of the stencil files to open as well as the type, size, and position of window to display them in based on their appearance when you saved the template.

Note If you are creating a template for scaled drawings, the page scale is set by the template's drawing page. The master scale is determined by the scale at which the shape is drawn. To avoid unexpected behavior, masters and drawing pages should use the same or a similar scale. For details, see Chapter 12, Scaled Shapes and Measured Drawings.

TOP

About Pages, Backgrounds, and Layers

As you design a Visio template, you should consider how you want to organize the information you plan to include. The Visio application provides display and organizational tools such as pages, backgrounds, and layers for arranging elements visually; you can use these tools to make your solutions work more effectively.

About pages and backgrounds

Templates and documents can contain multiple drawing pages, and each drawing page can have one or more background pages assigned to it. Background pages appear behind drawing pages, and usually contain shapes that you want to appear on more than one drawing page. You can use backgrounds to create visual layers of information. If you assign a background to another background, the newly assigned background appears behind both the original background and the drawing page.

Shapes on background pages cannot be modified from the foreground page; to modify background page elements, you must first navigate to the background page. As you develop a solution, you'll want to consider whether shapes will appear on both foreground pages and background pages, and whether your document templates should contain backgrounds.

Backgrounds and pages work like stacked sheets of transparent paper. When you assign a background (C) to another background (B), it appears behind both the original background and the drawing page (A); the drawing page always appears on top.

Backgrounds and pages work like stacked sheets of transparent paper. When you assign a background (C) to another background (B), it appears behind both the original background and the drawing page (A); the drawing page always appears on top.

About layers

You can use layers to organize masters and shapes into named categories within templates and drawings.

In other graphics programs, the term layers often refers to the stacking order (the front-to-back position) of objects on the page. In Visio, layers organize related shapes into named categories. A shape's membership in a layer has no effect on its position in the stacking order.

You can hide or show layers, print them or not, or protect layers from changes. Shapes can be assigned to more than one layer, and the layer information for a shape is independent of its display order and even its group membership. Additionally, each page in a document can have its own set of layers. When you design masters, you can assign them to layers; when users create instances of those shapes, they are automatically assigned to those layers.

Shapes can belong to more than one layer. Here, the lake and compass shapes belong to the Streets layer (A), the Landmarks layer (B), and the Routes layer (C).

Shapes can belong to more than one layer. Here, the lake and compass shapes belong to the Streets layer (A), the Landmarks layer (B), and the Routes layer (C).