Together with known ways to use user and workgroup templates Windows folders, the 2007 Microsoft Office system gives a possibility to use templates located on web sources. It is combined with the tools to customize the New Document dialog box for Word, PowerPoint and Excel.
The source http://technet.microsoft.com/en-us/library/cc178976.aspx gives good guidelines to start with web deployment.
Limitations
· The method needs to work online when creating new documents. If you want typing documents in a train or in an airport, think about making an offline replica of a web application with templates, or saving templates on your PC.
· To deploy the templates, you have to prepare XML files, preview and thumbnail images. If the preparation of XML files can be scripted, images have to be done manually.
Issues and work around
Deployment templates on SharePoint - authentication issue
If you used a template saved on a SharePoint site to create a document, you or other users can be prompted to log in to the SharePoint site when opening the document. It happens even if anonymous access is enabled on the template site. If the login is ignored, the document still opens. This happens because of a known authentication issue between SharePoint and Office:
http://social.technet.microsoft.com/forums/en-US/sharepointadmin/thread/7c69af51-d1b1-4642-b5fc-548663dd4564/
http://webborg.blogspot.com/2007/12/how-to-open-office-document-in-document.html
After all fiddling on access settings, the conclusion was: don’t deploy Office templates on a SharePoint site.
An easy work around may be just publishing the document in PDF format.
International
LCID in folder names
Pay attention that the examples in http://technet.microsoft.com/en-us/library/cc178976.aspx have 1033, the ID of the US English language locale. If the language of Microsoft Office user interface is different from English, the templates will not be shown. The XML files have to be b adapted. If users in your organization have different locales, you have to prepare variations of XML files per language. If the user interface of Microsoft Office on a PC has been changed, the templates have to be reinstalled.
Non-Latin characters
If your language is using other characters than 26 “standard” Latin letters, you have to encode the characters in XML files explicitly. In particular, it is required for Latin characters with diacritics (accents, umlauts, etc.) See an example:
<o:featuredtemplate title="PV réunion" source="http://templateprovider.client.com/templates/ PV%20reunion%20FR.dotx">
Here the (ANSI) code é represents the Latin letter with accent é.
The provider names in the registry also have to convert such characters. For example, to get é, you have to use the character with ANSI code 130 (shown as comma in text files):
HKCU\Software\Microsoft\Office\12.0\Common\Spotlight\Providers\Comit‚ for Comité
Sorting issue – numbers sorted as texts
Normally the template thumbnails are shown in the same order as they are listed in the XML file. But if a template group contains more than nine templates, their order in UI is different. It happens because templates get ordinal numbers used in registry keys and folder names. And both these values are sorted as texts, so that 10 and 19 come before 2. If you want to show thumbnails in proper order, make a formula which sorts the original XML entries in the way which is turned correctly when sorted as a text.
Delays
When the templates are just installed on a PC, the groups are shown in the New Document dialog box, but template thumbnails are not. Go out and go in, then you get the templates.
Different versions of Windows
Office 2007 works in Windows XP or later. But the structure of the registry and the folders is different in Windows 7, Vista and XP. So the scripts used to install or to uninstall the templates will also be different.
Bulk processing
Our client is using about 200 different Office templates varied by document type, language, institute, and availability of mail merge. Their client PC’s have to be maintained consistently.
The needed XML files can be created either by software utilities or by Excel spreadsheets with formulas based on lists of templates.
The installation of the templates is done by a batch file which uses commands of getting, creating and setting registry keys. The script can identify the Windows version and the language locale of Microsoft Office user interface, and adapt the installation accordingly:
rem works for both Vista and XP
reg query "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\LanguageResources" /v UILanguage >c:\temp\uilang.txt
rem check Dutch
find "413" c:\temp\uilang.txt
if %errorlevel% equ 0 goto setlang1043
rem check French
find "40C" c:\temp\uilang.txt
if %errorlevel% equ 0 goto setlang1036
rem check German
find "407" c:\temp\uilang.txt
if %errorlevel% equ 0 goto setlang1031
del c:\temp\uilang.txt /f /q
This script creates one group of Word templates entitled “Comité”:
:regkey
:source
:langid
set regkey=HKCU\Software\Microsoft\Office\12.0\Common\Spotlight
set source=http://templateprovider.client.com
:setlang1036
set langid=_fr
reg add %regkey%\Providers /f
reg add "%regkey%\Providers\Comit‚" /f
reg add "%regkey%\Providers\Comit‚" /v ServiceURL /d "%source%/xml/comite_wd%langid%.xml" /f
reg add "%regkey%\Providers\Comit‚" /v Application /d "WD" /f
A good guide about managing registry keys in command prompt can be found here:
http://www.chaminade.org/MIS/Articles/RegistryEdit.htm
The batch file itself can be created by a script.
Don’t forget about keeping systems clean. Together with the installation batch file, foresee another one to uninstall the templates. Put the code to clean up the registry and the Office folders for any template which was ever used in the organization. Remember that the system creates several registry keys and folders in user profile for each template, and all of them have to be deleted when uninstalling the template. If it is not done, the obsolete template versions or group titles may stay in cache and pop up when the user tries to open the latest version.
Here is a sample script of clean uninstall of one group of templates in Vista:
:regkey
:locfiles
:spotlight
:cookies
set regkey=HKCU\Software\Microsoft\Office\12.0\Common\Spotlight
set locfiles=http://templateprovider.client.com/
set spotlight="C:\Users\%username%\AppData\Local\Microsoft\Office\Spotlight\Office 12"
set cookies="C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Cookies"
rem Deletion of Providers registry keys per organisation/Office application
reg delete "%regkey%\Providers\Client docx" /f
reg delete "%regkey%\Content\Client docx" /f
rem Cleaning cookies
del %cookies%"\*client*.txt"
rem Cleaning cache
rd %spotlight%"\Client docx" /s /q
and in XP:
:regkey
:locfiles
:spotlight
:cookies
set regkey=HKCU\Software\Microsoft\Office\12.0\Common\Spotlight
set locfiles=http://templateprovider.client.com/
set spotlight="C:\Documents and Settings\%username%\Local Settings\Application Data\Microsoft\Office\Spotlight\Office 12"
set cookies="C:\Documents and Settings\%username%\Cookies"
rem Deletion of Providers registry keys per organisation/Office application
reg delete "%regkey%\Providers\Client docx" /f
reg delete "%regkey%\Content\Client docx" /f
rem Cleaning cookies
del %cookies%"\*client*.txt"
rem Cleaning cache
rd %spotlight%"\Client docx" /s /q
The batch files prepared for Vista run perfectly in Windows 7 when started from file system. You can easily start the batch files from web locations (e.g. SharePoint site) in Vista and XP, but in Windows 7 they will not work: the access will be denied. The bacth files have to be copied to file system and started from there.