Share via


Using Styles in Stencils and Templates

When you're designing stencils and templates for others to use, your styles should be consistent and easy to apply. Users can perceive styles as the only formatting options available, so it's often better to include a larger number of styles in your templates than your user might need.

The Style list on the Formatting toolbar makes styles that apply text formatting easily accessible.

The Style list on the Formatting toolbar makes styles that apply text formatting easily accessible.

In this section…

Keeping Styles Consistent across Files

Using Naming Conventions for Styles

Guidelines for Defining Styles

Keeping Styles Consistent across Files

When you create a stencil that will be used with a template, the style definitions should be the same in both the stencil and template files. When a user creates an instance of a master, the instance inherits the master's styles, which are applied as follows:

  • If a style of the same name does not already exist in the drawing file, it is copied from the stencil file and added to the drawing file.
  • If a style of the same name already exists in the drawing file, the existing style is used.

If the style's definition in the drawing file differs from the definition in the stencil file, the drawing's definition is used, and the shape's appearance in the drawing is different from that of the master. This behavior is sometimes referred to as the "home team wins" rule, because the style on the drawing page "wins" over the formatting attributes of a style with the same name in a master.

If you plan to save the drawing page as a stencil or template, you'll save file space by deleting any styles that are not used by your shapes. To do this, use the Define Styles command on the Format menu and delete styles that you haven't used. Alternatively, you can open a new drawing file that contains only the default styles, and then drag the shapes formatted with the styles you want to copy into the new file. For details about cleaning up stencils and templates, see Chapter 13, Packaging Stencils and Templates.

If a shape on the drawing page or on the document stencil uses a style that you delete, the following occurs:

  • If the style was based on another style, the shape assumes the base style.
  • If the style wasn't based on another style, the shape assumes the No Style style, a default Microsoft® Visio® style that cannot be edited or deleted.

TOP

Using Naming Conventions for Styles

The styles you create for your stencils and templates will be easier to use if you consistently follow a naming convention. Explicit style names, such as "Quarter-Inch Black Line" or "8-pt Arial Left," are more expressive and understandable than abbreviated names, such as "Line2" or "T8L." Styles appear in alphabetic order in the toolbar list and in the Style and Define Styles dialog boxes.

Good naming conventions keep related styles together in the lists, making it easier for users to find the styles they need. Line, fill, and text styles with similar attributes should have similar names. For example, if you name a 1-pixel-wide line style "1 Pixel Line," you should name a 3-pixel-wide line style "3 Pixel Line" rather than "Line3." It's a good idea to name styles based on how you expect them to be used:

  • Name styles specific to a shape or stencil according to the shape (or shapes) they're applied to, such as "Flow Connector Text."
  • Name general-purpose styles according to their formatting attributes, such as "Black Line" or "Arial Centered."

Tip To make a style appear at the top of the Style list, preface the style's name with a character that has a low ASCII value, such as a hyphen (-). For example, "- Standard Line" or "- Corporate Blue."

TOP

Guidelines for Defining Styles

Visio developers follow these guidelines when defining styles. The following guidelines may be helpful as you define styles for the solutions you create:

  • Text styles should use the TrueType fonts provided with the Microsoft® Windows® operating system.
  • Fill and line styles should use colors supported by a standard 256-color VGA monitor.
  • Base styles on Normal, rather than on each other.
  • Design styles to apply only one formatting attribute class (fill, line, or text), or all three.