Share via


Deploy custom templates in Office 2010

 

Applies to: Office 2010

Topic Last Modified: 2012-01-27

Banner stating end of support date for Office 2010 with link to more info

In Microsoft Office 2010, you can create and deploy templates that users can select when they create new documents, presentations, or worksheets.

You can create and deploy these Office 2010 templates for users of Microsoft Word 2010, PowerPoint 2010, and Excel 2010.

In this article:

  • Creating and deploying custom templates

  • Create your templates

  • Create thumbnail and preview files

  • Create an XML configuration file that describes the custom template, thumbnail, and preview files

  • Deploy a registry key that enables Office to read the XML configuration file

Creating and deploying custom templates

You can create custom templates and make them available to users in the Available Templates pane that is displayed when they click New on the File menu. The steps involved in this process are as follows:

  1. Create your templates.

  2. Create thumbnail and preview files.

  3. Create an XML configuration file that describes the custom template, thumbnail, and preview files.

  4. Deploy a registry key that enables Office to read the XML configuration file.

Create your templates

To create custom templates, open a new or existing document, worksheet, or presentation, make your customizations, and then save the file as a template on a network folder or Web site.

The following example shows how to create a template in Word 2010. However, the steps are almost the same for Excel 2010 and PowerPoint 2010. For more information about creating templates, see Learn about templates in Office 2010 (https://go.microsoft.com/fwlink/p/?LinkId=212947).

To create a template (in Word 2010)

  1. Open a new or existing document in Word 2010.

  2. Customize the document.

  3. On the File menu, click Save As.

  4. In the tree pane, browse to a shared folder on the network (this can also be a folder on a web server).

  5. In the File name box, type the name that you want to use for your template.

  6. In the Save as type box, select Word Template, and then click Save.

Create thumbnail and preview files (optional)

This is an optional step, but thumbnail and preview files can be very helpful to users because they enable users to quickly view and select templates. To see examples of thumbnail and preview files, click Sample Templates, on the Available Templates pane. If you decide not to create thumbnail and preview files for a custom template, users see the name of the template in the Available Templates pane. A red X is displayed instead of the thumbnail and preview images.

To create thumbnail and preview files

  1. Use screen shots and an image editor to create the thumbnail and preview files. The following are suggested dimensions:

    Preview type Width Height

    Thumbnail

    100

    120

    Preview

    256

    350

  2. Save the files by using one of the following file types: .jpg, .png, .bmp, .gif.

Create an XML configuration file that describes the custom template, thumbnail, and preview files

To display your custom templates in the Available Templates pane, you must create an XML configuration file. Office 2010 references this file to determine how to locate and display your template, thumbnail, and preview files.

To create the XML configuration file

  1. Copy the sample xml file text that is provided in this article, and then paste it into a text editor, such as Notepad. For more information, see Sample text for XML configuration file.

  2. Edit the sample text as appropriate.

    You can use the sample schema definition (XSD) file text that is provided in this article to create an XSD file to validate the XML configuration file (optional). To create the XSD file, copy the sample validation text into a text editor, and then save it as an XSD file; for example, OfficeTemplates.xsd. For more information, see Sample text for XML schema definition (XSD) file.

  3. Save the edited text as an XML file (for example, ContosoTemplates.xml), and save it to a network share (this can also be a folder on a web server).

Sample text for XML configuration file

You can copy the following text into a text editor, such as Notepad, configure the text to define your custom templates, and then save the file as an XML file; for example, ContosoTemplates.xml.

The sample XML includes only one application id section, for Word 2010 templates: application id = "WD". You can add sections for Excel 2010 and PowerPoint by copying the everything between <o:application id="WD"> and </o:application>, and then changing the application id parameters to "XL" for Excel or "PP" for PowerPoint 2010.

Each featuredtemplate section represents a custom template that is within the application id. The sample XML includes four featuredtemplate sections. However, you may add or delete the sections depending on how many custom templates you have. For each featuredtemplate, configure the title, media (thumbnail), and preview information to describe your template. If you have not created a thumbnail or preview file, you can delete the attribute values that correspond to the media and preview information. A red X is displayed for the thumbnail and preview images in the Available Templates pane if you do not provide thumbnail and preview images to display.

<?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="2011-03-01" enddate="2013-03-01">

            <!-- 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>

Sample text for XML schema definition (XSD) file

You can use a schema definition (XSD) to validate your XML file. To create the XSD file, copy the following text into a text editor, and then save it as an XSD file; for example, OfficeTemplates.xsd.

You can then use the XSD file together with an XML editor that can perform schema validation, such as XML Notepad 2007.

<?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 Available Templates pane that users see when they click New on the File menu 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>

Deploy a registry key that enables Office to read the XML configuration file

After you customize the XML file, you must deploy a registry key that enables Office 2010 to display your templates in the Available Templates pane. The registry key must be deployed to each user who accesses the custom templates.

To create and deploy the registry key

  1. Create the following registry key:

    HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Common\Spotlight\Providers\[ProviderName]
    

    The [ProviderName] key represents the group of templates that are described in the XML file (for example, Contoso). It displays in the Available Templates pane under CustomTemplates in the affected Office 2010 application. The name that you enter must be 30 characters or fewer.

  2. Under the [ProviderName] key

    • Create a new string value named ServiceURL that indicates where the XML file that you created is located.

    • Optionally, you can create a string value that is named Application. It lists the application for which you are providing templates.

      The following table describes these strings:

      Value name Value data (Data type) Description

      ServiceURL

      String

      Specify either of the following:

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

      • The URL of the web service where the XML file that you created to deploy custom templates is located; for example, https://www.contoso.com.

      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.

  3. Use the Office Customization Tool (OCT) or another tool to deploy the registry key to users. For more information about how to use the OCT to distribute registry keys, see Add registry entries in the Office Customization Tool in Office 2010 article.