Sdílet prostřednictvím


Deploy custom templates in the 2007 Office system

Updated: July 5, 2007

Applies To: Office Resource Kit

This Office product will reach end of support on October 10, 2017. To stay supported, you will need to upgrade. For more information, see , Resources to help you upgrade your Office 2007 servers and clients.

 

Topic Last Modified: 2015-03-09

In the 2007 Microsoft Office system, organizations can customize the New Document dialog box on the Office Button for several 2007 Office system applications. You can create and deploy templates for Microsoft Office Word 2007, Microsoft Office PowerPoint 2007, and Microsoft Office Excel 2007 to the New Document dialog box. For example, you can provide custom templates for Office Word 2007 documents that users can choose when they create a new document. This topic explains how to create and provide the custom templates.

Note

In the 2007 Office system, object model support for customizing the File menu is replaced with the customization steps that are described in this topic.

In the New Document dialog box, custom templates appear under the Custom heading on the left, as shown below. In this example, the custom templates are grouped in the Contoso category.

New Document dialog box with custom templates

Follow these steps to provide custom templates in the New Document dialog box:

  1. Create and save custom templates for one or more applications.

  2. Copy the templates to a network folder or make the templates available on a Web site.

  3. Create thumbnail and preview image files for the templates (optional).

  4. Modify the sample XML text to provide information that is specific to your custom templates. Use the provided XSD text to validate your customized file. See Sample XML text and Validating your XML file for custom templates later in this topic.

  5. Save the customized XML file to a network folder. Specify the path to the folder by using a registry key entry or provide the XML file from a Web service.

Create and save custom templates

It is straightforward to create templates for Office system applications. Open a new or existing document in the application and make customizations. Save the document as a template.

For example, use the following steps to create a template in Office Word 2007.

To create a template in Office Word 2007

  1. Open a new or existing document in Office Word 2007.

  2. Customize the document.

  3. Click the Office Button, point to Save As and click Word Template.

  4. In the File name: field, type the name of the template and click OK.

An Office Word 2007 template file is saved with a .dotx extension. The file extension for other Office application templates is similar; for example, Microsoft Office Excel templates have an .xltx extension.

Copy the template files to a network file server or provide the files on a Web site after you create and save the custom templates your organization needs.

Creating thumbnail and preview files

Create thumbnail and preview files of the custom templates; for example, by using screenshots and an image editor. You specify the image type of the thumbnail and preview files in the XML file. Choose from a variety of image types for the files, as specified in the XSD file. For example, you can use the GIF image type.

The approximate dimensions for the files are provided in the following table.

Preview type Width Height

Thumbnail

100

120

Preview

256

350

Click a template in the Microsoft Office Online section of the New Document dialog box for examples of thumbnail and preview files. For example, click Agendas in Office Word 2007.

Create a custom XML file that describes the custom templates

The 2007 Office system references an XML file to populate the items that are shown in the New Document dialog box. To include custom templates in New Document, you customize and provide an XML file that includes the location of the templates you want to display, together with the location of thumbnail and preview images for the templates. After you complete the configuration, custom templates appear in the New Document dialog box under the heading Custom.

To simplify the process of creating the XML file, base your custom XML on the text provided in the Sample XML text section later in this topic.

There are separate sections for each template type in the XML (for example, Word templates) and there are sections for each custom template within those sections: TEMPLATE 1, TEMPLATE 2, and so on. The sample XML includes a section for Office Word 2007 templates (application id = "WD"). You can also have sections for Office Excel 2007 templates (application id = "XL") and Office PowerPoint 2007 templates (application id = "PP").

The sample XML file includes four featuredtemplate sections. Delete or add template sections, depending on how many templates you have. Then modify the entries to specify the following for each template section:

  • A friendly name for the template in the title string and the location of the template in the source string.

  • The media type, filename, and location of the thumbnail preview for the template in the next source string.

  • The media type, filename, and location of the large preview for the template in the final source string.

You can delete the attribute values for the corresponding source string entries if you have not created a thumbnail preview file or a large preview file. A red X appears for the template in the thumbnail and preview areas of the New Document dialog box if you do not provide an image to display.

In the sample XML file, the folder structure for the template entries is:

  • Contoso\Source: template files (for example, .dotx)

  • Contoso\media: thumbnail files

  • Contoso\preview: preview files

Save the modified file in a network folder after you customize the XML file. This location is referenced in a registry key that you deploy to your users.

Alternatively, you can create a Web service to provide the XML content. You create a registry key that directs the Office application to the network folder or Web service for the XML file. See the next section, Configure Office to use the custom templates, for details.

Configure Office to use the custom templates

After you customize the XML file, you deploy a registry key to users to enable Office 2007 to display your templates in the New Document dialog box in Office 2007 applications. You configure the registry key differently depending on whether the templates are located on a network folder or if they are provided by a Web service.

You create the following registry subkey entry to provide the location of the XML file:

HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\Spotlight\Providers

Create a provider name entry under this registry subkey—for example, Contoso—for the group of templates that you want to provide that are described in the XML file. The provider name must be 30 or fewer characters. The name displays in the New Document dialog box in Office 2007 applications, followed by the list of custom templates.

Under the provider name, specify the ServiceURL where the custom XML file you created is located. Optionally, you can list the application for which you are providing templates, as described in the following table.

Value name Value data (Data type) Description

ServiceURL

String

Specify either:

1. The network folder and XML file; for example, \\server\public\templates\Contoso\WordTemplates.xml)

-or-

2. The URL of the Web service where the XML file that you created for deploying custom templates is located; for example, https://www.contoso.com. Details about this option are described below.

Application

String

Optional: Specify WD for Word templates, XL for Excel templates, or PP for PowerPoint templates. Do not include this registry key entry if the group of templates includes templates for more than one application.

The ServiceURL string is the provider to which the Office application sends a request for the XML file when you provide the templates by using a Web service. The Web service responds by providing the XML file. The request from the Office application includes the following parameters:

  • App: the Office application value (XL, WD, or PP).

  • LIDUser: the user language.

  • LIDHelp: the user Help language.

  • LIDUI: the user interface (UI) language.

For example, an Office application request for the XML file might be:

https://www.contoso.com?app="XL"&liduser=0409&lidhelp=0409&lidui=0409

You can use the Office Customization Tool (OCT) or other methods to deploy the registry key to users. Information about using the OCT to distribute registry keys is provided in the Add registry entries section of Office Customization Tool in the 2007 Office system.

Sample XML text

You can copy the following text into a text editor, such as Notepad, and modify the content to simplify creating the XML that is required to deploy custom templates with Office applications. Save the file as an XML file; for example, ContosoTemplates.xml.

To validate the XML file, use the text provided in the next section, Validating your XML file for custom templates.

<?xml version="1.0" encoding="utf-8"?>
<o:featuredcontent lcid="1033" xmlns:o="urn:schemas-microsoft-com:office:office">
    <o:application id="WD">
        <o:featuredtemplates startdate="2007-01-01" enddate="2009-03-02">

            <!-- TEMPLATE 1 -->
            <o:featuredtemplate title="Template 1" source="\\server1\public\templates\Contoso\Source\1.dotx" >
                <o:media mediatype="gif" filename="1.gif" source="\\server1\public\templates\Contoso\media\1.gif" />
                <o:preview filename="1big.gif" source="\\server1\public\templates\Contoso\preview\1.gif" />
            </o:featuredtemplate>

            <!-- TEMPLATE 2 -->
            <o:featuredtemplate title="Template 2" source="\\server1\public\templates\Contoso\Source\2.dotx" >
                <o:media mediatype="gif" filename="2.gif" source="\\server1\public\templates\Contoso\media\2.gif" />
                <o:preview filename="2big.gif" source="\\server1\public\templates\Contoso\preview\2.gif" />
            </o:featuredtemplate>

            <!-- TEMPLATE 3 -->
            <o:featuredtemplate title="Template 3" source="\\server1\public\templates\Contoso\Source\3.dotx" >
                <o:media mediatype="gif" filename="3.gif" source="\\server1\public\templates\Contoso\media\3.gif" />
                <o:preview filename="3big.gif" source="\\server1\public\templates\Contoso\preview\3.gif" />
            </o:featuredtemplate>

            <!-- TEMPLATE 4 -->
            <o:featuredtemplate title="Template 4" source="\\server1\public\templates\Contoso\Source\4.dotx" >
                <o:media mediatype="gif" filename="4.gif" source="\\server1\public\templates\Contoso\media\4.gif" />
                <o:preview filename="4big.gif" source="\\server1\public\templates\Contoso\preview\4.gif" />
            </o:featuredtemplate>

        </o:featuredtemplates>
    </o:application>
</o:featuredcontent>

Validating your XML file for custom templates

Use the text provided in this section to validate your customized XML file for providing custom templates in Office applications. Copy the text into a text editor, such as Notepad, and save the file as an XSD file; for example, OfficeTemplates.xsd.

<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="urn:schemas-microsoft-com:office:office" elementFormDefault="qualified"
  xmlns="urn:schemas-microsoft-com:office:office" xmlns:o="urn:schemas-microsoft-com:office:office"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="featuredcontent">
<xs:annotation>
  <xs:documentation>
This is the schema for custom spotlight providers in the new FileNew dialog in Word, Excel, and PowerPoint.
Copyright (c) Microsoft Corporation.
  </xs:documentation>
</xs:annotation>
<xs:complexType>
  <xs:sequence>
<xs:element name="application" minOccurs="1" maxOccurs="unbounded">
  <xs:annotation>
<xs:documentation>
  Include one application block for every application you have custom templates for
</xs:documentation>
  </xs:annotation>
  <xs:complexType>
<xs:sequence>
  <xs:element name="featuredtemplates" minOccurs="0" maxOccurs="1">
<xs:complexType>
  <xs:sequence>
<xs:element name="featuredtemplate" minOccurs="0" maxOccurs="unbounded">
  <xs:complexType>
<xs:sequence>
  <xs:element name="media" type="CT_ImageAttributes">
<xs:annotation>
  <xs:documentation>
The media element refers to the thumbnail (small) image for the template
  </xs:documentation>
</xs:annotation>
  </xs:element>
  <xs:element name="preview" type="CT_ImageAttributes">
<xs:annotation>
  <xs:documentation>
The preview element refers to the preview (large) image for the template
  </xs:documentation>
</xs:annotation>
  </xs:element>
</xs:sequence>
<xs:attribute name="title" type="ST_SpotlightString" />
<xs:attribute name="source" type="xs:anyURI" />
  </xs:complexType>
</xs:element>
  </xs:sequence>
  <xs:attribute name="startdate" type="ST_Date" use="required" />
  <xs:attribute name="enddate" type="ST_Date" use="required" />
</xs:complexType>
  </xs:element>
</xs:sequence>
<xs:attribute name="id" type="ST_Application" use="required" />
  </xs:complexType>
</xs:element>
  </xs:sequence>
  <xs:attribute name="lcid" type="xs:unsignedShort" use="required" />
</xs:complexType>
  </xs:element>
  <xs:simpleType name="ST_Application">
<xs:annotation>
  <xs:documentation>
Specifies the application for which to deliver spotlight content
  </xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
  <xs:enumeration value="WD" />
  <xs:enumeration value="XL" />
  <xs:enumeration value="PP" />
</xs:restriction>
  </xs:simpleType>
  <xs:complexType name="CT_ImageAttributes">
<xs:sequence />
<xs:attribute name="mediatype" type="ST_MediaType">
</xs:attribute>
<xs:attribute name="filename" type="ST_Filename" use="required" />
<xs:attribute name="source" type="xs:anyURI" use="required" />
<xs:attribute name="alttext" type="ST_SpotlightString" use="optional" />
  </xs:complexType>
  <xs:simpleType name="ST_SpotlightString">
<xs:restriction base="xs:string">
  <xs:maxLength value="255" />
  <xs:minLength value="1" />
</xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="ST_MediaType">
<xs:restriction base="xs:string">
  <xs:enumeration value="jpg" />
  <xs:enumeration value="png" />
  <xs:enumeration value="bmp" />
  <xs:enumeration value="gif" />
</xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="ST_Date">
<xs:annotation>
  <xs:documentation>
Date must be specified in YYYY-MM-DD format
  </xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
  <xs:pattern value="[0-9]{4}-[0-9]{2}-[0-9]{2}" />
</xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="ST_Filename">
<xs:annotation>
  <xs:documentation>
Filename cannot contain \ ? | > : / * " or less-than, must be less than 260 chars, and have a valid extension.
Example: image.jpg
  </xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
  <xs:pattern value="[^\\\?|&gt;&lt;:/\*&quot;]{1,259}" />
</xs:restriction>
  </xs:simpleType>
</xs:schema>