Archives for October 11, 2012

Word of Law No. 14 – Tracing Styles from Template to Document

[Originally appeared 1999.]

One correspondent asked about the advice  to store keystrokes assignments for Styles in a Global Template. She expressed her frustration about not being able to use a global template to distribute to users the organization’s Styles themselves as well as the keystrokes.

To respond thoroughly to that question requires an understanding of the functions of different kinds of templates, a strategy for using them and how styles fit into the picture. Let’s start by answering the question directly, and then begin to step back to the broader view.

Global Templates are templates loaded and made available to all of the operations of Word, no matter what document is being edited currently. The list of active global templates can be found in the dialog launched by Tools | Templates and Add-ins. The lower portion of that dialog lists “Global templates and add-ins.” These include the .dot files stored in the Word startup file location (set by the Startup entry in the File Locations tab of the dialog launched by Tools | Options). Those files are automatically loaded every time Word starts. Templates located in other locations can be made global by loading them manually after Word starts. This can also be done under macro control.

While a loaded global template enables its keystroke assignments to users (along with a number of other features, including as AutoText, menus, toolbars and macros) it does not make its styles available to documents. The short answer to the correspondent’s question, then, is no. True, a macro solution could be devised to work around this limitation. It would not be consistent with the strategy for Word advocated here.

We begin a broader exploration by tracing styles from template to document.

A document obtains its styles first from the template from which it was created. I like to call such templates “File | New” Templates (pronouncing the | as a kind of short required pause). This refers to their use in the dialog launched by default by File|New. The creation of a new document opens a new document with copy of the text of the template and copies the styles and their parameters to the new document. It also makes the source template the “attached template” for the document. This is shown in the upper portion of the Templates and Add-ins dialog.

During the life of a document, the values for styles in that document can change as users modify the styles directly, or copy the styles from another template using the Style Gallery tool. While we have already touched on the Style Gallery and will explore it further, it can be best understood as a visual tool for applying a fairly simple command. It can copy the styles and their parameters from the templates located in the File|New folder/directory tree to the current document. The command itself is ActiveDocument.CopyStylesFromTemplate (Template Name as String). While the Style Gallery only displays the templates in the File|New tree, the command can use any template.

Word has a setting that can force styles back to their default settings from the attached template. It appears in the check box labeled “Automatically update document styles” near the top of the Templates and Add-ins dialog. When checked, the values for all styles in the document included in the attached template will update to the values in the attached template each time the document is opened. The use of the word “update” in this context seems to refer to the ability to distribute revised versions of templates and conform documents based on them to any changes in the parameters of their styles. If instead the styles have been modified in the document rather then the attached template, this function will cause the parameters of the styles to revert to those of the attached template.

Curiously, checking the Automatically Update Document Styles box while editing and saving a template does not enable it for documents based on that template. Without any macro help, a user must set that value manually after a document is created. One way to force documents based on a template to have this function enabled is to include AutoNew macro in the template. The command is ActiveDocument.UpdateStylesOnOpen = True.

There are dangers and traps here for developing, maintaining and promoting effective use of templates and styles, especially for an organization that seeks to follow the Laws of Styles (issue 4.20). From my perspective, user confusion can be minimized by providing a good set of tools and standards, but not over automating their functions.

An organization needs a set of File|New templates from which its most frequently used documents are created, including ones for blank documents. These should employ a common and consistently named set of styles as described in the Laws of Styles. The correspondent’s search for a single universal set of styles for an organization is not consistent with this recommendation. Documents should be able to transform their formatting from time to time. If text has the same function in differently formatted documents, it should have the same style name (the third Law of Styles). Then the Style Gallery tool will allow the document to be reformatted to the alternative standard in one step. If styles need to be reset to the values in their source template, the Style Gallery (or a macro) can do this intentionally. From a user perspective, this power applied deliberately should be less confusing than enabling the automatically update function.

This 1999 article originally appeared in Office Watch.Subscribe to Office Watch free at http://www.office-watch.com/.