BEHIND THE CURTAIN: STYLES’ ORDER OF OPERATIONS

Intro: What's a Style

In Word, a style defines a set of formatting properties that are indirectly applied to characters, paragraphs, list, or tables. Instead of directly applying bold, then 14 point font, and then red to text, you can use a style to indirectly apply these three things in a single click. This is useful because you can quickly and consistently apply rich formatting, and can later change the definition of the style all the text the style is applied will change.

For example, the Heading 1 style in Word 2003 specifies the font, font size, and font color properties (among others) as: Arial, 16 point, and automatic, while in Word 2007 Heading 1's font, font size, and font color properties are: Cambria, 14 point, and blue-Accent 1-Darker 25%. Because these properties changed Between Word 2003 to Word 2007, applying the Heading 1 style in Word 2003 will give you a different looking heading than if you did the same thing in Word 2007. And if you are not a big fan of Heading 1 in 2003 or 2007, you can change the font, font size, and font color properties in both versions and those changes will be applied to every instance of Heading 1 in the given document. Quick, consistent, and rich formatting that can be changed once and trickle through the whole document.

Note: This does not mean that when you open a document created in Word 2003 in Word 2007 that all instances of Heading 1 will change. It just means that applying Heading 1 for the first time in Word 2007 will give you different results than applying Heading 1 for the first time in Word 2003. We store the properties of each style in the document to ensure that once applied they look the same regardless of which version of Word you open the file in.

That's a really really quick introduction to styles. I'm going to spend the rest of this post going deeper into the various types of styles and how they relate to one another. If you are not 100% clear on the basics of styles, please read Stuart's previous post before reading further.

Six Types of Styles

The Heading 1 style is an example of only one of many types of styles in Word. Specifically, it is an example of a linked style. Linked styles are a specific set of formatting properties that can be applied to entire paragraphs or subsets of paragraphs.

Experiment: Put your cursor in a paragraph, don't select anything, and click Heading 1. It is applied to the whole paragraph. This is the paragraph side of the linked style. Now, select a subset of another paragraph and click Heading 1. It is applied only to the subset. This is the character side of the linked style.

The other types of styles enable you to apply a specific set of formatting properties to other content in Word, and they are:

  • Character styles: define a set of formatting properties that can be applied to subsets of paragraphs. Example: Strong

  • Paragraph styles: define a specific set of formatting properties that can be applied to an entire paragraph Example: Normal

Fun Fact: You can easily identify Linked, Character, and Paragraph styles in the Styles Pane with the follow icons

  • Table styles: define a specific set of formatting for tables as well as for characters and paragraphs within the table. Example: the whole gallery shown when you insert a table in Word 2007

  • Numbering styles: define a specific set of properties for the list itself (i.e. graphic used for the bullet or Arabic vs. Roman numerals for your numbered list).

  • Document Defaults: define a specific set of global formatting properties for paragraphs and characters in this document

    Optional Experiment: Open a new scrap document. Type "=rand()". Underline some text and make it red. Select that text, right click, and click Font. Click Default in lower left of the dialog that comes up. Click No. Note that all the Normal text in your document is underlined and red. Type a new paragraph, insert a comment, and type in the comment. Note that all of this text is underlined and red. This is all a result of you changing the Document Defaults.

    Note: For those of you who would like to do more advanced manipulation of your document defaults, you can modify them directly via the following dialog

How styles relate to one another

You may be wondering how Word deals with all this style. I can get you 80% of the way there with a relatively simple explanation. The remaining 20% is more complex and less common, so I'll go there only if I need to in later posts.

In short, styles build on top of one another. For example, if you have a numbered paragraph in a table, then the style layering logic in Word essentially works like this [Word is "speaking" in the example]:

  • "Document Defaults, tell me what properties to apply to paragraphs and characters by default."
  • "Table Style, tell me how the table should look—i.e., row shading, borders, etc.—and if you have any additional paragraph and character properties (i.e., stuff not in the Document Defaults). If you have additional properties, I'll add them. If you have any of the same properties as the Document Defaults—such as line spacing—but different values for those properties—such as 1 vs. 1.5—I'll use yours."
  • "Paragraph Style, do you have any additional paragraph properties (i.e. stuff not in the Document Defaults or Table Style) that I need to apply to this paragraph? If you specify the same paragraph properties as the any of the previously applied styles I'll use yours."
  • "Numbering Style, tell me how the numbered list should look and if you've got additional paragraph properties that I don't have yet. Of course, if you have different values for properties that I do already have, I'll use yours."
  • "Character Style, do you have any additional character properties (i.e. stuff not in the Document Defaults or Table Style) that I need to apply? If you have the same character properties as the any of the previously applied styles, I'll use yours."
  • "Is there any direct formatting—bold, italics, underline, font color, etc.—applied? If so, I'll use those."

This story hopefully illustrates that:

  • Multiple styles can be applied to the same part of a document, so properties defined in styles are applied in a specific order.
  • The properties set by one type of style can be supplemented or superseded by other types of styles.
  • The general hierarchy of style types is [from lowest to highest priority]:
    • Document Defaults
    • Table Styles
    • Paragraph Styles | Paragraph Part of Linked Styles
    • Numbering Styles
    • Character Style | Character Part of Linked Styles
    • Direct Formatting

That's really the bulk of it. And while I don't have a nifty mnemonic device like Please Excuse My Dear Aunt Sally to help you remember the order of operations for styles [feel free to suggest some J], hopefully this helps you better understand styles, and how they are ordered and applied in Word.

-Jonathan Bailor

Office Blogs Comments

Comments: (7) Collapse

  • Jonathan, Great post. Hey, what happens to cause the default styles to get, ughm...overwritten. Thats a big problem that I see with our documents due to, what I can only image, activities of some of our pretty ignorant (of these matters) users. We deal with templates for documents with our own style set. Lets call the default style CustomStyle. We also copy / paste good portions of documents as they are reused. Through this, after we do this, the CustomStyle disappears from the Style list (to complicate matters, we use 2003 predominantly, but Im sure its similar in 2007), and there is a plethora of things like CustomStyle + 12pt, CustomStyle + Red, etc. - in the style "gallery." So, every time a user modifies a formatting of a paragraph with style applied - probably through not knowing how to work with styles properly - it seems like a new style is added; whats worse - the original style is "deleted" - my guess, modified. So the question is how / why does it happen and how to avoid it. Bonus question is - how to reverse it (probably, very very difficult). Thanks in advance, Ilya

  • Hi Ilya – Great question. To really answer your question, I need more than this plain text comment field will allow. So if it’s ok with you, I’d like to answer your question in a future post on the Format Tracking feature within the Styles Manager. -Jonathan Bailor (MS)

  • Thank you for this post. Im a happy W2007 user but still have to use W2003 in my business. Word 2003, at least with table styles, does not seem to follow your hierarchy. Is it new or revised for W2007? Also, when an unlinked style (char) is present, all bets are off. Can you tell us how and why a the presence of a char style, say Header char, can affect the seemingly unrelated style Caption and even affect the grid lines of table using table styles? PamC

  • Hi PamC - The hierarchy is not new. The control that you have around Document Defaults is. My next post will talk more about Normal vs. Document Defaults. Let me know if it helps. Regarding char styles: There is no direct relationship between a “char” (or “para”) style appearing and problems with other styles; the only way that they would interact is if the linked styles were defined as part of the “based on” style hierarchy. That being said, we hear you pain and have fixed some bugs around this in recent patches [i.e. please make sure and your teammates are up to date with Microsoft Updates]. The issue you are seeing is possibly the result of someone who has worked on the document using an un-patched version. - Jonathan Bailor (MS)

  • Thank you for a great post. What I want to do is to enable users to set new company document style and defaults on existing documents. Setting styles i can do, but how to reset document defaults. I dont want users messing with the dialog box and setting three properties in the dialog box for every existing document. So the question is: how do I access document defaults via macro? Macro recording ends up empty? Any other option? Sincerely, Domen Ferbar

  • Hi Domen – It sounds like you want to create a set of Styles for you company and that you want these Styles to ‘ignore’ any changes made to the Doc Defaults. Try the following macro after creating the Style Set you’d like your company to use: Sub setQuickStyleSetAsDefault() open template as a document for editing Dim doc As Document Set doc = NormalTemplate.OpenAsDocument apply a quick style set to the template doc.ApplyQuickStyleSet (" ") save the template and close doc.Close (wdSaveChanges)

    End Sub - Jonathan Bailor (MS)

  • When I change the spacing *before* in the Document Default the text in a table changes. So I cannot use Document Default to have my text outside a table with other spacings than inside a table. Only spacing after and line spacing can be different inside and outside a table.

Comments

Comments: (loading) Collapse