Share via


Working with Styles in the Drawing Page

Styles are named collections of formatting attributes that you can apply to a shape. In Microsoft® Visio®, a single style can define text, line, and fill attributes, so applying a style can be an efficient way to promote consistency in your shapes.

When you apply a style to a shape, you format the following attributes:

  • For text The font, size, style (such as bold or italic), color, transparency, and character spacing; text block alignment, margins, and background color; paragraph alignment, indents, and spacing; tab spacing; and bullet formatting.
  • For lines The line weight, color, transparency, pattern, cap, arrowhead style, and corner style.
  • For fills The pattern and the foreground and background colors and transparency for a shape's interior (its fill) and for its shadow, if there is one.

In this section…

Understanding Styles

Setting Default Styles for a Drawing

Creating a New Style

Editing a Style

Understanding Styles

You can apply a style to a shape, or you can apply local formatting using the commands on the Format menu to achieve the same effect. If many of your shapes have the same format, styles provide a more efficient use of computer resources than local formatting. A style definition is stored in only one place in a Visio document, and several shapes can refer to it. With local formatting, all the formatting instructions are stored separately with each shape. Shapes formatted using styles respond faster than locally formatted shapes when they are created, moved, scaled, and rotated.

Local formatting attributes are stored with each shape (A). When you apply a style to multiple shapes, the style�s definition stores the formatting information in one place (B).

Local formatting attributes are stored with each shape (A). When you apply a style to multiple shapes, the style's definition stores the formatting information in one place (B).

A style can contain various attributes from three main style attribute classes: Text, Line, and Fill. Each attribute class corresponds to a ShapeSheet section:

  • Line Format for the Line attribute class.
  • Fill Format for the Fill attribute class.
  • Character, Text Block Format, Paragraph, Bullets, and Tabs for the Text attribute class.

Each style attribute within an attribute class corresponds to a ShapeSheet cell, such as FillForegnd and FillPattern in the Fill Format section. A single style can define attributes in one or more of the attribute classes of Text, Line, or Fill.

In the documents you create, you can separately define styles for text, line, or fill, or you can define styles that apply a combination of attributes from these attribute classes. You can find the styles displayed in the following places in the user interface:

  • Styles that apply to text appear in the Style list on the Formatting toolbar or the Text Style list on the Format Text toolbar.
  • Styles that apply to fills and lines are listed in the Line Style and Fill Style lists on the Format Shape toolbar.
  • Styles that apply to text, lines, and fills are listed in the Style dialog box (on the Format menu, click Style).
  • All styles in a document are listed in the Styles folder in the Drawing Explorer (on the View menu, click Drawing Explorer Window).

When a user applies a style to a shape that has local formatting, any cells in the shape that correspond to the enabled attribute classes in the style inherit attributes from the style instead of the master.

For example, if a shape's line is locally formatted and you apply a style that specifies only text and fill formatting, the local formatting of the line remains intact. By right-clicking a shape, pointing to Format, and then clicking Style on the shortcut menu, users can also apply styles independently for text, line, or fill. For example, suppose that local formatting has been applied to a shape's text, but the user wants to apply a style just for the fill and line that normally applies attributes for the fill, line, and text. By choosing fill and line styles in the Style dialog box, those attributes are applied, while the text formatting is untouched. For details, see Protecting Local Shape Formats later in this chapter.

TOP

Setting Default Styles for a Drawing

When you are drawing a number of shapes, you can ensure consistency by specifying the styles that you use most often as the document's default styles. The Visio engine applies the default text, line, and fill styles currently set for a drawing page when you draw using any of the tools on the Standard toolbar. You can also set default styles for a template's drawing page to help its users draw consistently or according to particular standards.

To change a document's default styles

  1. Make sure nothing is selected and that the drawing page window is active. On the Format menu, click Style.
  1. In the Text style, Line style, and Fill style boxes, select the new default styles you want, and then click OK.

TOP

Creating a New Style

You can create a new style to include in your template or to quickly and consistently format several shapes. The styles you define in your templates appear to the user in the Drawing Explorer, in the Style and Define Styles dialog boxes, and, if they apply text formatting, in the Style list on the Formatting toolbar.

You can create a new style from scratch or base it on an existing one. For example, say you have created a line and entered a formula that evaluates to 3 mm in the LineWeight cell. If you are drawing many 3 mm lines, it's efficient to create a style that you can reuse. The advantage of creating new styles based on existing ones is that you can then develop a hierarchy of styles, in which the changes made to one style are inherited by all of the styles that are based upon it, as the following figure shows. You must be careful, however, not to inadvertently edit a series of styles—and all the shapes formatted with those styles—when you mean to edit only one.

Deriving a new style from an existing base style

Deriving a new style from an existing base style

  1. Base style definition
  1. Derived style definition
  1. The derived style inherits its line and fill from the base style.
  1. Editing the base style changes the derived style.

When you create a new style, settings are inherited depending on whether the style is created from scratch or based on an existing one. Consider the following:

  • A style that you base on another style inherits the base style's attributes.
  • A style that you create from scratch inherits the default document settings as a starting point for the attributes that you check under Includes in the Define Styles dialog box. You can change some or all of these settings to define your style.

To create a style, click Define Styles on the Format menu. The Based on option controls whether the style is based on another. For details about using the Define Styles dialog box, search the Microsoft Visio Help (on the Help menu, click Microsoft Visio Help).

If you define a style for a drawing and want to use it in another drawing, you can copy the style. To do this, drag a shape formatted with the style into the file to which you want to add the style. (Alternatively, copy and paste the shape.) Then delete the shape. The style definition remains in the file. If the file already contains a style with the same name, the existing definition takes precedence, and the style will not be copied into the file.

Note If you use the technique of copying a shape into a different drawing file to create a style, be aware that a copy of the master for that shape instance will be created on the document stencil. If you are using the drawing file to create a template, you'll probably want to delete the master from the document stencil before you save the file as a template.

TOP

Editing a Style

You can edit a style in two ways:

  • On the Format menu, click Define Styles, select an existing style from the Style list in the Define Styles dialog box, and then change the style's Text, Line, or Fill attributes.
  • Make changes to the style's formulas in the ShapeSheet window.

Making changes in the Define Styles dialog box is a straightforward and user-friendly method. However, not all of the options available in a style's ShapeSheet® window can be accessed through the Define Styles dialog box. For example, you can define formulas related to a style by editing cells in the style's sheet.

To edit a style's formulas

  1. On the View menu, click Drawing Explorer Window.
  1. In the Drawing Explorer, open the Styles folder, right-click the style, and then click Show ShapeSheet on the shortcut menu.
  1. Make changes to the formulas in the style's sheet.