Microsoft Word architecture consists of three layers: the Word application, the document, and the template. Each of these layers affects Word documents in a different way. The Word application provides the standard Word menus, commands, and toolbars. Templates serve a dual purpose: they provide a model for creating new documents and also act as a storage container for styles, macros, AutoText entries, and customized Word commands and toolbar settings. The document file contains the text, graphics, formatting, and settings such as margins and page layout for that particular document.
The key to understanding Word architecture is understanding how the document, template, and application layers interact. Of the three layers, the template is the layer that has the greatest impact on both the document and the application layers.
Templates can provide the following:
Users can customize the Word application with templates. With templates, you can adapt Word menus, toolbars, keyboard assignments, and macros to meet the needs of different types of users or for different types of documents.
For example, you can create a template for new users that has a toolbar with buttons and menus designed to step them through common tasks. More advanced users, who are familiar with the tasks, don't need the extra guidance and can use a template with toolbar buttons that meet their particular needs.
A template provides a guide or pattern for creating documents. By basing a group of documents on a single template, users can quickly create standard documents, such as letters and memos, with consistent formatting and standard text.
For example, a template for memos can save users time by setting the page margins, inserting the company logo, and providing the text for standard headings, such as "Memo," "To:," and "From:." With part of the work already done for them, users simply fill in the additional text.
In Word, all documents are based on a template. When a user creates a new document, it initially has the characteristics of the selected template. A user can create a new document in several ways.
If the user |
Available templates are |
---|---|
Clicks New on the File menu in Word |
All Word templates and wizards as defined in the user's User Templates location. Word templates have the file extension .dot. Word wizards are specialized templates with the file extension .wiz. |
Clicks Start A New Document on the Office Shortcut Bar |
All Office templates as defined in the User and Workgroup templates locations for the Office Shortcut Bar. Word templates are on the General, Letters and Faxes, Memos, Reports, Other Documents, and Publications tabs. |
Clicks the New button on the Standard toolbar in Word |
Normal template. The New dialog box does not appear |
Unless users select another template when creating a new document, Word defaults to the Normal.dot template. In addition to Normal, Word comes with templates for the most common types of documents, such as letters, memos, reports, and mailing labels. Users can use the templates as they are or customize them to their own specifications. Users can also create their own templates.
In addition to basing a new document on a template, users can attach a different template to an open document at any time by clicking Templates on the File menu.
Items stored in the Normal template are global -- that is, available to all documents. These items include AutoText entries, macros, menu assignments, toolbar button assignments, and keyboard assignments. If a document is attached to a template other than the Normal template, the items stored in that template are available only to documents that are also based on that template.
Document settings and commands specific to only one type of document, such as a fax sheet, are available only to documents based on that template. Other commands and components, such as AutoText entries, that you want available to all documents should be placed in a global template. By using custom and global templates judiciously, your users have a flexible method for creating documents that can be highly customized while adhering to company-wide standards of design.
Sometimes users may want to use a macro, toolbar, or AutoText entry from another template. To make these items available to all open documents, you can make a template global. Users can then use the macros, AutoText entries, and customized command settings found in both the global and Normal templates in all their documents. However, styles in the global template are not added to your users' documents; Word continues to use the styles from the template on which the document is based. Customized items in the global template are available for the remainder of the current Word session.
Use the Templates command on the File menu to open a template as a global template.
You may have special toolbar settings or other items stored in a template that you want to make available to users at any time they are using Word. For example, you may have a special corporate or workgroup template that contains special macros and AutoText entries that all users may want to use. Rather than duplicating this information in every copy of the Normal template, you can make this template available globally when a user starts Word.
To load a template globally at startup, make a copy of the template. Store the duplicate in the Startup folder, which is inside the Winword folder (or the folder indicated in the Startup-path entry of the Registry key Hkey_Current_User\ Software\Microsoft\Word\7.0\Options). Do not simply move the template from its original folder. Doing so makes the template unavailable when a user creates a new document by clicking New on the File menu.
The Office Setup program sets default locations for different kinds of documents and Word components: user documents, user templates, spelling dictionaries, clip art, and so forth. Users can change these default locations by choosing Options on the Tools menu. For information about changing these defaults systematically, see "Modifying Client Setup with the Network Admin Wizard Application" in Chapter 9.
Changing settings for User Templates and Workgroup Templates in Word changes them for all Office applications. For more information about specifying user and workgroup templates, see "Starting a New Document" in Chapter 1.
In a workgroup, there are usually two places where Word templates are stored:
When creating a new document, templates from both the User Templates folder and the Workgroup Templates folder are listed together in the New dialog box.
By default, Word stores user templates in the Template folder. For workgroup templates, there is no initial default setting. To change the default location, click Options on the Tools menu, and then choose the File Locations tab. Select User Templates or Workgroup Templates from the File Types list, and click Modify. Enter or select the new folder for user templates and for workgroup templates.
At startup, Word looks for the Normal template in the following locations: the user's Template folder, the Winword folder, and the current folder -- in that order. If Word cannot find the Normal template, Word uses the standard document and command settings that have been preset by Microsoft. AutoText entries, macros, and command settings the user stored for global use in the Normal template will not be available until the user returns the Normal template to one of the default search locations and then restarts Word.
When Word is first installed, there is no Normal.dot file. It is constructed and saved the first time a user exits Word.
Document ContentsThroughout the discussion of templates, you may have noticed that more than one template can affect the working environment of a document. Each document has access to the macros, AutoText entries, and custom commands and toolbar settings from the attached template, the Normal template, and any global templates. These templates, as well as add-ins or Word itself, may each define a macro or setting in some way that differs from the other templates or add-ins associated with a document. The definition or setting that takes precedence is the one that resides closest to the document. Therefore, Word resolves such conflicts in the following order of priority:
For example, the style Heading 1 is defined in the Normal template as Arial bold, 18 points, but the document is attached to a template where the style Heading 1 is defined as Times Roman bold, 24 points. Word uses the setting in the attached template, so Text formatted to the Heading 1 style is in Times Roman bold, 24 points.
If several global templates have conflicting settings, Word resolves the conflicts in the order in which they are listed in the Templates And Add-ins dialog box. Templates in the Startup folder appear at the top of the list and have a higher priority. Subsequent ranking on the list is determined by alphabetic order.
Document ContentsThe various components of Word, such as styles, macros, default page settings, AutoText entries, AutoCorrect entries, and custom command settings are stored at two levels of Word's three-level architecture. Some components reside strictly at the document level, others reside at the template level, and still others are stored with both the document and the template. Of those components that reside at the template level, some are stored specifically with the Normal or the attached template, while others can also be stored in a global template. The table below shows how components from each kind of template affect the document and what is contained in the document file.
Component |
Document file |
Attached template |
Normal template |
Global templates |
---|---|---|---|---|
Document text and graphics |
ü |
|||
Boilerplate text and graphics |
ü |
ü 1 |
ü 1, 3 |
|
Styles |
ü |
ü 2 |
ü 2, 3 |
|
Default page settings |
ü |
ü 1 |
ü 1, 3 |
|
AutoText entries |
ü |
ü |
ü |
|
Macros |
ü |
ü |
ü |
|
Custom command and toolbar settings |
ü |
ü |
ü |
|
AutoCorrect formatted text entries |
ü 4 |
1 Copied to the document when first created.
2 Copied to the document when first created or each time document is opened if the option to automatically update styles is selected.
3 Applies only to documents attached to the Normal template.
4 All plain text AutoCorrect entries are stored in the Windows 95 Registry.
When a document is first created, Word copies all information from the attached template including boilerplate text and graphics to the document file. From that point on, the text and graphics are saved with the document file. Changes in the boilerplate text and graphics in the template will not affect documents previously created with that template.
When users create a new document, Word copies styles from the template on which the document is based. No link between template styles and documents styles is made. So, when users change the styles in the document, those changes are saved with the document file. Likewise if users change styles in the template after the document is created, those changes are not automatically reflected in the document.
To automatically update the document styles to match the template, click Templates on the File menu and select the Automatically Update Document Styles check box. Each time a user opens the document, Word copies the styles in the attached template to the document.
The AutoFormat command analyzes text in a document and applies styles as appropriate from the styles that have been copied to the document. These document styles originally come from the attached template.
If AutoFormat cannot find an appropriate style among those in the document, it uses the built-in styles provided by Word. These built-in styles allow AutoFormat to format body text, headings, bulleted lists, and other text elements. Users can customize built-in styles in their documents by clicking Style on the Format menu and then clicking Modify. Customizing a built-in style in a user's document has no effect on the original style, because the built-in style is copied to the document by AutoFormat.
The following illustrations show some of the built-in styles you can use to format common text elements.
When users apply styles to text in a document -- either by using the AutoFormat command or by applying styles themselves -- they can use the Style Gallery command on the Format menu to see how the appearance of the document changes according what template is applied.
By using the Style Gallery, a user may decide to apply a different template to the document. When a user chooses to use the styles from another template, Word copies all styles from the selected template into the document. This has the following effects:
For example, suppose the Heading 1 style in the template is defined as Arial 14-point bold, and the Heading 1 style in the document is defined as Times 12-point italic. Word redefines the Heading 1 style in the document as Arial 14-point bold. All paragraphs formatted with the Heading 1 style are changed to reflect the new style definition.
The Style Gallery command does not attach the selected template to the active document. Rather, it copies the styles from the selected template to the active document. The template on which the active document is based remains attached to the document. To attach a different template to a document, use the Templates command on the File menu.
Users can also use the Style Gallery to preview their own templates. To create an example document, they select the text in the template and assign it the predefined AutoText entry Gallery Example. This predefined AutoText entry is displayed in the preview box of the Style Gallery when Example is selected.
AutoText entries are stored in templates. In order for users to use the AutoText entry in any Word document, store it in the Normal or other global template. If you want to make the AutoText entries available only in documents of the same type as the active document, store them in the template attached to the active document.
To add or edit AutoText entries in a global template, you must open the template in a non-global mode. This is because global templates cannot be edited. To open a global template non-globally, you can open it directly (in the File Open dialog box, select Document Templates in the File Of Type box), or open a document to which the template is attached -- not a document to which the template has been loaded.
To determine whether a template is attached or loaded into a document, click Templates on the File menu. The template whose name appears in the Document Template box is the attached template, and is editable. The template whose name appears in the Global Templates And Add-ins box is a loaded template and is read-only.
Word stores macros in templates. When a user creates a new macro, it is stored by default in the Normal template and is available globally. A user can also specify which template a macro should be attached to.
To store a new macro in a template other than Normal, either the template itself or a document attached to the template must be active when the user creates the macro. If users want to create a new macro in a global template, they must open the template itself rather than an attached document. When attached to a document, global templates are read-only.
Together, macros and templates can be used to create a highly customized version of Word designed to accomplish a particular task or set of tasks. For example, a group of macros and templates could be designed to automate the creation of forms and other documents a company uses. Because the macros are stored in one or more custom templates, the custom version of Word is relatively simple to distribute; it's just a matter of copying the templates. If the macros are stored in the Normal template instead, it is much more complicated to install the custom version on another machine, which already has its own Normal template.
Any AutoCorrect entries that use formatted text, with Formatted Text selected in the AutoCorrect dialog box, are specific to Word, and are stored in the user's own Normal template.
By customizing toolbars, menus, and shortcut keys, you can change Word to better suit the needs of your users. For example, you can add frequently used commands and dialog box options to toolbars and menus. And you can remove items users rarely use. You can also customize shortcut key assignments by creating the shortcut keys that work best for your users.
To customize toolbars, menus, and shortcut keys, click Customize on the Tools menu. You can specify whether to store these customizations in the Normal template, an open template, or the template attached to the active document. To make customized settings available in any document, save the settings in the Normal template or to a template that will be made global.
Default page settings for the document layout, such as margins, layout, and paper size, are similar to styles. The default settings are saved with a template. Each new document based on that template inherits those default settings from the template. Subsequent changes to the settings in the document reside with the document and are not automatically saved to the template. However, these settings can be stored in the template.
To save settings from the document to the attached template, click Default in the Page Setup dialog box. The changes will be reflected in subsequent documents created from this template.
Document ContentsUsers may want to take advantage of styles, toolbars, macros, or AutoText entries that have already been created in another template. They can use the Organizer dialog box to copy these items between templates. Styles can also be moved between templates and documents.
Users can also use the Organizer to delete or rename styles, AutoText entries, macros, or toolbars. To open the Organizer, click Templates on the File menu and then click Organizer.
Document ContentsFrom a user perspective, a wizard is a fast, easy way to create a document -- because the wizard does the work. Architecturally, wizards are specialized templates. They are designated with a .wiz extension instead of a .dot extension, and their Type is described as MS Word Wizard rather than MS Word Template. The wizards that come with Word all share a common user interface. The key component of the wizard is the macro or set of macros stored with the template. These macros automate the creation of the document.
Word provides wizards to help users create the following types of documents: agenda, award, calendar, fax cover sheet, legal pleading, letter, memo, newsletter, and resume. Word also includes a wizard to help users create tables. You can create your own wizards to step users through complex tasks specific to your company. For more information about creating your own wizards, see "Creating a Wizard," in Chapter 9 of the Microsoft Word Developer's Kit.
Document ContentsAdd-ins are programs written in the C programming language. They act like custom commands or custom features you can use in Word. For more information about add-ins, see Appendix C in the Microsoft Word Developer's Kit.
You can place add-in commands on toolbars and menus or assign them to shortcut keys, just as you can with Word macros. Architecturally, add-ins fit in at the template layer. They modify toolbars, menu commands, and shortcut keys just like templates.
You can write your own add-ins or obtain them from software vendors. To use an add-in, you must load it into Word. Add-ins are installed and loaded the same way global templates are. Like a template, the add-in program remains available until you quit Word. If you want to load an add-in program automatically each time you start Word, store it in the Startup folder.
Send us your comments