Word 2003 Template

Word 2003 Template

The default Word 2003 template was modified to provide support for the creation of a technical manual. The following sections identify those changes.

Named Styles

Named paragraph and character styles are used in Word 2003 as a means for reuse of common formatting properties. They are also a significant component in the technical manual XSL transform, as they provide a simple reference point when applying formatting to certain content in the output stream.

The default Word 2003 template uses only a small set of named paragraph styles:

  • Document Title

  • Heading 1

  • Heading 2

  • Heading 3

  • Normal

These default styles were modified to allow for different formatting characteristics, such as spacing, underscoring, and enumeration. In addition to the modification of existing styles, new styles were added for paragraphs, tables, numbered and bulleted lists, and six more heading levels.

Figure 1. Selected styles in the Word 2003 template

Saving the Word 2003 template as an XML file creates a new WordML "styles" section at the top level of the document. This section will get copied over to the XSL file that is developed later. A fragment from the styles section follows:

<w:style w:type="paragraph" w:styleId="Paragraph">
    <w:name w:val="Paragraph"/>
    <w:basedOn w:val="Normal"/>
    <w:rsid w:val="002C382C"/>
    <w:pPr>
        <w:pStyle w:val="Paragraph"/>
        <w:spacing w:after="120"/>
    </w:pPr>
    <w:rPr>
        <wx:font wx:val="Times New Roman"/>
    </w:rPr>
</w:style>
<w:style w:type="table" w:styleId="TableGrid">
    <w:name w:val="Table Grid"/>
    <w:basedOn w:val="TableNormal"/>
    <w:rsid w:val="002C382C"/>
    <w:rPr>
        <wx:font wx:val="Times New Roman"/>
    </w:rPr>
    <w:tblPr>
        <w:tblInd w:w="0" w:type="dxa"/>
        <w:tblBorders>
            <w:top w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
            <w:left w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
            <w:bottom w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
            <w:right w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
            <w:insideH w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
            <w:insideV w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
        </w:tblBorders>
        <w:tblCellMar>
            <w:top w:w="0" w:type="dxa"/>
            <w:left w:w="108" w:type="dxa"/>
            <w:bottom w:w="0" w:type="dxa"/>
            <w:right w:w="108" w:type="dxa"/>
        </w:tblCellMar>
    </w:tblPr>
</w:style> 

Title Page, Header, and Footer

In order to more closely resemble the look and feel of a technical manual, a title page, header, and footer were added to the Word 2003 template. Although these Word 2003 constructs contain some variable data within them, they are essentially static sections of a WordML file that can be copied over to the XSL file.

The title page is represented as a table containing the FabriKam International logo, the manual title, the manual contributors and their associated roles, and the manual completion date.

Figure 2. The title page of the technical manual

When the Word 2003 template is saved as an XML file, a new WordML table element is created within the document body. The logo is saved as binary data, and this data cannot be manipulated in any way when the table is copied over to the XSL file.

The header contains the manual title and page count, while the footer contains copyright information. Each is defined in a section properties element, which appears at the end of the document body in the WordML output. This section properties element is shown below.

<w:sectPr>
    <w:hdr w:type="odd">
        <w:p>
            <w:pPr>
                <w:pStyle w:val="Header"/>
                <w:jc w:val="right"/>
            </w:pPr>
            <w:r>
                <w:t>Wallingford, Night Stand</w:t>
            </w:r>
            <w:r>
                <w:tab wx:wTab="885" wx:tlc="none" wx:cTlc="19"/>
                <w:t>Page </w:t>
            </w:r>
            <w:r>
                <w:fldChar w:fldCharType="begin"/>
            </w:r>
            <w:r>
                <w:instrText> PAGE </w:instrText>
            </w:r>
            <w:r>
                <w:fldChar w:fldCharType="separate"/>
            </w:r>
            <w:r>
                <w:rPr>
                    <w:noProof/>
                </w:rPr>
                <w:t>2</w:t>
            </w:r>
            <w:r>
                <w:fldChar w:fldCharType="end"/>
            </w:r>
            <w:r>
                <w:t> of </w:t>
            </w:r>
            <w:r>
                <w:fldChar w:fldCharType="begin"/>
            </w:r>
            <w:r>
                <w:instrText> NUMPAGES </w:instrText>
            </w:r>
            <w:r>
                <w:fldChar w:fldCharType="separate"/>
            </w:r>
            <w:r>
                <w:rPr>
                    <w:noProof/>
                </w:rPr>
                <w:t>4</w:t>
            </w:r>
            <w:r>
                <w:fldChar w:fldCharType="end"/>
            </w:r>
        </w:p>
    </w:hdr>
    <w:ftr w:type="odd">
        <w:p>
            <w:pPr>
                <w:jc w:val="center"/>
            </w:pPr>
            <w:r>
                <w:t>© 2004: </w:t>
            </w:r>
            <w:hlink w:dest="http://www.fabrikam.com/">
                <w:r>
                    <w:rPr>
                        <w:rStyle w:val="Hyperlink"/>
                    </w:rPr>
                    <w:t>FabriKam, International</w:t>
                </w:r>
            </w:hlink>
            <w:r>
                <w:t>    --    All Rights Reserved</w:t>
            </w:r>
        </w:p>
    </w:ftr>
    <w:pgSz w:w="12240" w:h="15840"/>
    <w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800" w:header="720" w:footer="720" w:gutter="0"/>
    <w:cols w:space="720"/>
    <w:titlePg/>
    <w:docGrid w:line-pitch="360"/>
</w:sectPr>

Placeholder Text

In the Technical Manual Creation form, the project manager can select optional sections (such as the Foreword or Glossary) to appear in the Word 2003 file. These sections are placeholders for the technical manual writer, and they are represented as chapter-level elements in the Word 2003 template. The body of the placeholder section is simply an instruction to insert the corresponding content.

Figure 3. A placeholder section

Technical Manual Schema

Since the technical manual template uses smart document modifiers (see the section Smart Document), a schema must be registered for the document in the Word 2003 schema library. This action is performed in Word 2003 by selecting Templates and Add-Ins from the Tools menu. Then, on the XML Schema tab, the document schema can be added to the library.

Figure 4. Modifying the Word 2003 schema library

The schema for the technical manual template uses wrappers for the chapter, section, and subsection elements as well as wrappers for titles and content at each of those three levels. A sectionType attribute is used to specifically identify the type of section.

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="techManual" targetNamespace="schemas.fabrikam.com/v3.0/technicalManual/v1.0" elementFormDefault="qualified" xmlns="schemas.fabrikam.com/v3.0/technicalManual/v1.0" xmlns:mstns="schemas.fabrikam.com/v3.0/technicalManual/v1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="document">
        <xs:complexType>
            <xs:choice minOccurs="1" maxOccurs="unbounded">
                <xs:element ref="section" minOccurs="1" maxOccurs="unbounded"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
    <xs:element name="section" type="TYPEsection"/>
    <!--  TYPES  -->
    <xs:complexType name="TYPEsection">
        <xs:sequence>
            <xs:element name="title" type="xs:string" minOccurs="1" maxOccurs="1"/>
            <xs:element name="content" type="xs:string" minOccurs="1" maxOccurs="1"/>
            <xs:element ref="section" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="sectionType" type="TYPEsectionType"/>
    </xs:complexType>
    <xs:simpleType name="TYPEsectionType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="toc"/>
            <xs:enumeration value="forward"/>
            <xs:enumeration value="generalWarnings"/>
            <xs:enumeration value="fundamentals"/>
            <xs:enumeration value="howToUse"/>
            <xs:enumeration value="chapter"/>
            <xs:enumeration value="section"/>
            <xs:enumeration value="subsection"/>
            <xs:enumeration value="glossary"/>
            <xs:enumeration value="index"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>

The section element is the main wrapper element for document chapters, sections, and subsections. The title and content elements are the nested wrappers within a section element, as shown in the following example:

<ns13:section sectionType="glossary">
    <ns13:title>
        <w:p>
            <w:pPr>
                <w:pStyle w:val="Heading1" />
                <w:listPr>
                    <wx:t wx:val="1" wx:wTabBefore="0" wx:wTabAfter="255" />
                    <wx:font wx:val="Times New Roman" />
                </w:listPr>
            </w:pPr>
            <w:r>
                <w:t>Glossary</w:t>
            </w:r>
        </w:p>
    </ns13:title>
    <ns13:content w:placeholder="Enter Glossary here">
        <w:p>
            <w:pPr>
                <w:pStyle w:val="Paragraph" />
            </w:pPr>
        </w:p>
    </ns13:content>
</ns13:section>

 

© 2005 Microsoft Corporation. All rights reserved.