If you've used styles in Microsoft Word to format documents, you understand what a time-saver they can be. You select some text, choose a style from the style list on the toolbar, and you're done. Styles in Visio work in much the same way to give shapes a consistent look and make them easier to revise. However, in Visio, you can apply styles to shapes as well as text. That difference makes Visio styles unique.
Think of a Visio style as a collection of text, line, and fill formats that have a name. For example, the Flow Normal style is applied to flowchart shapes to provide a consistent look. What the Flow Normal style actually applies is 8-point Arial text with 2-point margins, a black border with a specified thickness (line weight) around shapes, and solid white fill color in shapes. All Visio templates come with some styles built in. You can see the styles in the Style list on the Formatting toolbar, as Figure 23-1 shows. The five styles you always see are Guide, Normal, None, Text Only, and No Style.
Figure 23-1. The Style list on the Formatting toolbar displays all the built-in styles that come with a template; styles from the Basic Flowchart template are shown here.
Visio lists all styles in the Style list on the Formatting toolbar regardless of whether they apply a line, fill, or text format. However, Visio also includes style lists on the Format Text toolbar and Format Shape toolbar, which you can display by choosing View, Toolbars as Figure 23-2 shows. You can also apply styles using the Styles command on the Format menu. Unnecessary redundancy? Turns out, there's a method to the madness. Depending on which style list you work from, different formats can be applied, which matters when a single style specifies text, line, and fill attributes, and you want to apply only one set of attributes.
Figure 23-2. For quick access to line and fill styles, you can display the Format Shape toolbar (top). To apply text styles, display the Format Text toolbar (bottom).
For example, the Flow Normal style appears in Text Style, List Style, and Fill Style lists, which are displayed on the Format Text and Format Shape toolbars, as Figure 23-3 shows.
Figure 23-3. A Visio style can appear in the Text Style, Line Style, and Fill Style lists. The list's appearance shows you whether the style applies a text (left), line (center), or fill format.
There is only one Flow Normal style, but its effects can differ depending on the list from which you select the style. Weird? Maybe, but it gives you flexibility. Here's how it works:
Knowing how the style toolbars work will help prevent style mishaps (like the solid black shape shown in Figure 23-4). However, it's hard to tell from the style name alone which type of formatting will be applied. Visio helps you out with a message as Figure 23-4 shows. When Visio asks, "Do you want to apply all of the included formatting," you have two choices, and both result in something being formatted:
With either option, some formatting will be applied. You can't cancel the action, but you can click Ctrl+Z to reverse the results.
Nothing happens when a style is applied to a shape.
If you select a shape and apply a style, and nothing happens, the shape might be locked or guarded. Some shapes include built-in protections that prevent you from formatting them when the format might disrupt the shape's smart behavior. Sometimes you can work around these protections, and sometimes you can't. For details, see "Formatting Locked Shapes."
Figure 23-4. If you select a style from the Line Style list, Visio prompts you before applying the style's fill format (solid black) to the shape.
For most people, the difference between applying a style or manually formatting a shape is really just the command they use. For Visio, the difference between manual formats and those applied by a style is in how the change is stored. Now we're talking file mechanics, and this is an interesting topic only if you plan to design your own templates or want to understand how actions on the drawing page affect shape formats. The Visio term for the formats you apply manually is local formatting—"local" because the changes affect settings that Visio saves with each shape. You apply a local format when you select a shape and use a toolbar button or command on the Format menu to change the appearance of text, line, or fill. In contrast, a style applies a global format, because Visio stores all the style definitions for a diagram in one place—that is, globally. If you're working with a diagram that contains many shapes, you'll get better performance if you use styles rather than local formatting to format your shapes.
When you copy shapes to another Visio drawing file, their formatting changes.
If you created or edited styles in your Visio diagram, and then copied it or parts of it to another Visio diagram, formats specified for the new diagram can override those in your shapes. This happens when the destination diagram has a style of the same name as the one you used to format your shapes. If the style in the new diagram is defined to format shapes differently, its styles will be applied to your shapes. To avoid reformatting, you can redefine your styles in the original Visio diagram to match those of the target diagram, or you can rename your Visio styles so that they don't match and your style will be used. For details, see "Creating and Editing Styles."
Applying a color scheme is similar to applying a style in that it's a quick technique for making widespread changes in a diagram. However, color schemes are different from styles in the way they interact with locally formatted shapes. When you apply a color scheme in a diagram type that supports their use (most of the business diagram types do), all the shapes, titles, borders, and backgrounds adopt coordinating colors from the scheme—unless you have locally formatted a shape's line and fill colors. Visio ignores locally formatted shapes, including shapes you create, so the color scheme isn't applied to them. After you apply a color scheme, the diagram's shapes retain their original style assignments.
For example, a flowchart is a diagram type that supports color schemes. To apply a color scheme, right-click a page, and then choose Color Schemes. All the flowchart shapes you dropped into the diagram from the flowchart stencil will be filled with a color from the scheme—with the exception of any shapes that include manually formatted line and fill colors, as Figure 23-5 shows. Manually formatted colors remain unchanged.
Figure 23-5. This flowchart's locally formatted Decision shape remains the same before and after applying a color scheme to the drawing.
What if you want all the shapes to adopt the color scheme colors? This is where styles and color schemes overlap to your advantage. If you restore the original styles to a shape, it will assume the color scheme automatically. To do this, see "Restoring the Factory Default Shape Formats."
Why does this work? The answer lies in how Visio really applies a color scheme. A color scheme maps new color values to existing style definitions. All shapes formatted with those styles adopt the new color scheme. That's why reapplying the master's format also applies the color scheme, and that's why some master shapes don't work with color schemes.
If you format a shape and then apply a style, you run the risk of losing the formats you applied. That's because applying a style resets all the formatting options that come with the style. In Visio terms, Visio overrides local formatting. This behavior can be a little unsettling if you're used to the way Microsoft Word works. In Word, you can individually format one word in a sentence—for example, apply italics—and then choose a different style for the paragraph, and the italics format will be retained. Visio doesn't preserve individual, local formats as Word does unless you know a few tricks.
One trick is to use the Style command on the Format menu, rather than the style lists on the toolbars. Then you can apply a style and prevent it from overriding your local formatting by selecting the Preserve Local Formatting check box, as Figure 23-6 shows. If you don't select the Preserve Local Formatting option, Visio applies the new style and overrides any local formatting.
Figure 23-6. The Preserve Local Formatting option in the Style dialog box lets you save any manual formatting you've applied to a shape and still apply the style.
Another trick is to use the toolbar style lists but be canny about which one you choose. For example, if you've manually formatted the text for a number of flowchart shapes but want to apply a style that changes their fill color, choose a style from the Fill Styles list. When Visio displays the message that asks you whether you want to apply the style's line and text formats as well, click No. That way, Visio applies only the fill formatting in the style, thus preserving your local text formatting.
You can remove local formatting from a shape and restore its original styles. One reason to do this is to make sure shapes look consistent when you're creating a new stencil or to make sure a shape adopts a diagram's color scheme. The Styles command provides an easy way to restore the styles that came with the master shape, as Figure 23-7 shows.
Figure 23-7. You can restore the default styles with the Format, Style command.
To restore default styles to a shape, follow these steps:
Visio shapes can be protected against formatting. When you try to apply a style to a protected shape, you might see the error message shown in Figure 23-8, or you might see nothing at all. It depends on whether the shape was locked or guarded, two methods of protecting formatting that can affect your ability to interact with shapes on the drawing page. Shape designers usually have good reasons for locking a shape, but that doesn't mean you don't have an equally good reason for unlocking it. It's always fun to defeat shape protections and have your way, but be prepared for odd results. Sometimes those locked formulas can have a domino effect on shape appearance or behavior.
Figure 23-8. Visio prevents you from editing a shape that's been locked.
To reset a shape so that you can apply a style, you must edit its ShapeSheet settings. To be on the safe side, make a copy of the shape first, and then edit the copy.
Follow these steps to unlock a shape:
If you don't see this section, choose View, Sections, select the Protection check box, and then click OK.
Sometimes you try to apply a style or choose a format, and nothing happens—no error message, no format change, nothing. It might be that the shape includes guarded ShapeSheet settings that prevent you from making the change. If you're a shape programmer, the GUARD function is a useful way to protect your formulas. If you're a user who wants to format a guarded shape, there aren't any simple workarounds. Formulas are guarded so that they aren't overwritten when users interact with shapes, and usually that's a good thing. It keeps the shape behaving the way it's supposed to.
For details about the GUARD function, see "Protecting Shape Formulas."