Template Distribution
This document function can be used to distribute various objects, such as PDF documents, images or macro-based add-ins for Excel or PowerPoint. The document function is also needed for mail themes with the required styles in mail templates and signatures. In the following table some elements are explained:
Tag | Explanation |
---|---|
Path | The storage location of the affected file can be selected here. |
Lockfile | This can be used to prevent an open file from being modified. For this purpose, the affected file including extension can be specified. |
Merge | It can be determined whether the file(s) should be replaced, removed or merged during an update. |
The document function is available exclusively for the following template types: "External file for distribution" and "Mail Theme".
"Scriptable"
The template distribution is able to read certain system variables and thus – depending on the environment – roll out other files. This is necessary to support different Office versions with an Office Add-In package for example. The system of "Scriptable Configs" can be used for this.
The API object has the following properties for Word, Excel, PowerPoint and Outlook respectively:
Field | Value | Description |
---|---|---|
IsDetected | Boolean true / false |
Returns whether the Office product is installed. |
Version | Integer |
Returns the installed Office version. |
Is32Bit | Boolean true / false |
Returns whether the Office product is installed in the 32-bit version. |
Is64Bit | Boolean true / false |
Returns whether the Office product is installed in the 64-bit version. |
For example, oo.Word.Version
returns the installed Word version if oo.Word.IsDetected
returns true
.
Office versions
Office version | Office 'Year' |
---|---|
14 | 2010 |
15 | 2013 |
16 | 2016/2019 |
Cleanup
Using Cleanup
created registry values and files/folders can be deleted again. Three commands are available:
<File Path="Path to File or Folder" />
This deletes the file or folder (including subfolders). Wildcards are also supported: i.e. using Path To Folder/*.txt
it is possible to filter for text files in a specific folder.
<RegistryKey Root="HKCU" Key="Path to registry key" View="Default|Registry32|Registry64" />
This deletes the specified registry key. View
can be omitted (default registry view).
<RegistryKey Root="HKCU" Key="Path to registry key" View="Default|Registry32|Registry64" Name="Valuename" />
This deletes the specified value in the registry. View
can be omitted (Default Registry View).
Execution time:
The cleanup process is executed:
- when OneOffixx is uninstalled.
- when OneOffixx is started with
/clean
. - by starting it manually in the template editor.
- or when changing or resetting the data source.
Caution
- For cleanup OneOffixx must have the template in cache – manually clearing the cache may prevent distributed templates from being removed automatically.
- For changes, make sure that older versions you rolled out earlier are also cleaned up properly.
Example
The following configuration verifies that it registers the correct 32-bit or 64-bit version of a PowerPoint add-in:
<Configuration>
<If Condition="oo.PowerPoint.Version == 15">
<Path>%APPDATA%\SomePowerpointAddin</Path>
<If Condition="oo.PowerPoint.Is32Bit">
<Registry>
<RegistryKey Root="HKCU" View="Registry32" Key="Software\Microsoft\Office\15.0\PowerPoint\AddIns\SomePowerpointAddin">
<RegistryValue Type="String" Name="Path" Expand="true">%APPDATA%\SomePowerpointAddin\SomePowerpointAddin.ppam</RegistryValue>
<RegistryValue Type="DWord" Name="AutoLoad">00000001</RegistryValue>
</RegistryKey>
</Registry>
<Cleanup>
<File Path="%APPDATA%\SomePowerpointAddin" />
<RegistryKey Root="HKCU" View="Registry32" Key="Software\Microsoft\Office\15.0\PowerPoint\AddIns\SomePowerpointAddin" />
</Cleanup>
</If>
<If Condition="oo.PowerPoint.Is64Bit">
<Registry>
<RegistryKey Root="HKCU" View="Registry64" Key="Software\Microsoft\Office\15.0\PowerPoint\AddIns\SomePowerpointAddin">
<RegistryValue Type="String" Name="Path" Expand="true">%APPDATA%\SomePowerpointAddin\SomePowerpointAddin.ppam</RegistryValue>
<RegistryValue Type="DWord" Name="AutoLoad">00000001</RegistryValue>
</RegistryKey>
</Registry>
<Cleanup>
<File Path="%APPDATA%\SomePowerpointAddin" />
<RegistryKey Root="HKCU" View="Registry64" Key="Software\Microsoft\Office\15.0\PowerPoint\AddIns\SomePowerpointAddin" />
</Cleanup>
</If>
</If>
</Configuration>
with API Object: oo.PowerPoint.Version = 15
, oo.PowerPoint.Is32Bit = true
and oo.PowerPoint.Is64Bit = false
results in the following:
<Configuration>
<Path>%APPDATA%\SomePowerpointAddin</Path>
<Registry>
<RegistryKey Root="HKCU" View="Registry32" Key="Software\Microsoft\Office\15.0\PowerPoint\AddIns\SomePowerpointAddin">
<RegistryValue Type="String" Name="Path" Expand="true">%APPDATA%\SomePowerpointAddin\SomePowerpointAddin.ppam</RegistryValue>
<RegistryValue Type="DWord" Name="AutoLoad">00000001</RegistryValue>
</RegistryKey>
</Registry>
<Cleanup>
<File Path="%APPDATA%\SomePowerpointAddin" />
<RegistryKey Root="HKCU" View="Registry32" Key="Software\Microsoft\Office\15.0\PowerPoint\AddIns\SomePowerpointAddin" />
</Cleanup>
</Configuration>
Mail Theme for Outlook
Caution
The style name and the .dotx file name must match.
To roll out a Mail Theme via the document function, the following configuration is necessary:
<?xml version="1.0" encoding="utf-8"?>
<Configuration SourceTemplateDocumentType="Zip">
<UpdateMode>ViaFiles</UpdateMode>
<Files>
<File Source="*.dotx" Target="%APPDATA%\Microsoft\QuickStyles\CompanyStyle.dotx" />
<File Target="%APPDATA%\Microsoft\QuickStyles\OneOffixxTheme.config">CompanyStyle</File>
</Files>
<Registry>
<RegistryFile>mailsettings.reg</RegistryFile>
</Registry>
</Configuration>
The mail theme is always dependent on the installed Outlook version. If you want to support two different Outlook versions, you have to duplicate the Mail Theme and customize it in the corresponding Outlook version.
PowerPoint
Note
The .ppam file must be imported zipped as "External template".
To roll out the OneOffixx PowerPoint Add-in, the following configuration is necessary:
<Configuration>
<Path>%APPDATA%\OneOffixx\PowerPoint</Path>
<LockFile>%APPDATA%\OneOffixx\PowerPoint\OneOffixx.ppam</LockFile>
<!-- Office 2016/2019 -->
<If Condition="oo.PowerPoint.Version >= 16">
<If Condition="oo.PowerPoint.Is32Bit">
<Registry>
<RegistryKey Action="CreateAndUpdate" Root="HKCU" View="Registry32" Key="Software\Microsoft\Office\16.0\PowerPoint\AddIns\OneOffixx">
<RegistryValue Type="String" Name="Path" Expand="true">%APPDATA%\OneOffixx\PowerPoint\OneOffixx.ppam</RegistryValue>
<RegistryValue Type="DWord" Name="AutoLoad">00000001</RegistryValue>
</RegistryKey>
</Registry>
<Cleanup>
<File Path="%APPDATA%\OneOffixx\PowerPoint" />
<RegistryKey Root="HKCU" View="Registry32" Key="Software\Microsoft\Office\16.0\PowerPoint\AddIns\OneOffixx" />
</Cleanup>
</If>
<If Condition="oo.PowerPoint.Is64Bit">
<Registry>
<RegistryKey Action="CreateAndUpdate" Root="HKCU" View="Registry64" Key="Software\Microsoft\Office\16.0\PowerPoint\AddIns\OneOffixx">
<RegistryValue Type="String" Name="Path" Expand="true">%APPDATA%\OneOffixx\PowerPoint\OneOffixx.ppam</RegistryValue>
<RegistryValue Type="DWord" Name="AutoLoad">00000001</RegistryValue>
</RegistryKey>
</Registry>
<Cleanup>
<File Path="%APPDATA%\OneOffixx\PowerPoint" />
<RegistryKey Root="HKCU" View="Registry64" Key="Software\Microsoft\Office\16.0\PowerPoint\AddIns\OneOffixx" />
</Cleanup>
</If>
</If>
<!-- Office 2013 -->
<If Condition="oo.PowerPoint.Version == 15">
<If Condition="oo.PowerPoint.Is32Bit">
<Registry>
<RegistryKey Action="CreateAndUpdate" Root="HKCU" View="Registry32" Key="Software\Microsoft\Office\15.0\PowerPoint\AddIns\OneOffixx">
<RegistryValue Type="String" Name="Path" Expand="true">%APPDATA%\OneOffixx\PowerPoint\OneOffixx.ppam</RegistryValue>
<RegistryValue Type="DWord" Name="AutoLoad">00000001</RegistryValue>
</RegistryKey>
</Registry>
<Cleanup>
<File Path="%APPDATA%\OneOffixx\PowerPoint" />
<RegistryKey Root="HKCU" View="Registry32" Key="Software\Microsoft\Office\15.0\PowerPoint\AddIns\OneOffixx" />
</Cleanup>
</If>
<If Condition="oo.PowerPoint.Is64Bit">
<Registry>
<RegistryKey Action="CreateAndUpdate" Root="HKCU" View="Registry64" Key="Software\Microsoft\Office\15.0\PowerPoint\AddIns\OneOffixx">
<RegistryValue Type="String" Name="Path" Expand="true">%APPDATA%\OneOffixx\PowerPoint\OneOffixx.ppam</RegistryValue>
<RegistryValue Type="DWord" Name="AutoLoad">00000001</RegistryValue>
</RegistryKey>
</Registry>
<Cleanup>
<File Path="%APPDATA%\OneOffixx\PowerPoint" />
<RegistryKey Root="HKCU" View="Registry64" Key="Software\Microsoft\Office\15.0\PowerPoint\AddIns\OneOffixx" />
</Cleanup>
</If>
</If>
<!-- Office 2010 -->
<If Condition="oo.PowerPoint.Version == 14">
<If Condition="oo.PowerPoint.Is32Bit">
<Registry>
<RegistryKey Action="CreateAndUpdate" Root="HKCU" View="Registry32" Key="Software\Microsoft\Office\14.0\PowerPoint\AddIns\OneOffixx">
<RegistryValue Type="String" Name="Path" Expand="true">%APPDATA%\OneOffixx\PowerPoint\OneOffixx_O2010.ppam</RegistryValue>
<RegistryValue Type="DWord" Name="AutoLoad">00000001</RegistryValue>
</RegistryKey>
</Registry>
<Cleanup>
<File Path="%APPDATA%\OneOffixx\PowerPoint" />
<RegistryKey Root="HKCU" View="Registry32" Key="Software\Microsoft\Office\14.0\PowerPoint\AddIns\OneOffixx" />
</Cleanup>
</If>
<If Condition="oo.PowerPoint.Is64Bit">
<Registry>
<RegistryKey Action="CreateAndUpdate" Root="HKCU" View="Registry64" Key="Software\Microsoft\Office\14.0\PowerPoint\AddIns\OneOffixx">
<RegistryValue Type="String" Name="Path" Expand="true">%APPDATA%\OneOffixx\PowerPoint\OneOffixx_O2010.ppam</RegistryValue>
<RegistryValue Type="DWord" Name="AutoLoad">00000001</RegistryValue>
</RegistryKey>
</Registry>
<Cleanup>
<File Path="%APPDATA%\OneOffixx\PowerPoint" />
<RegistryKey Root="HKCU" View="Registry64" Key="Software\Microsoft\Office\14.0\PowerPoint\AddIns\OneOffixx" />
</Cleanup>
</If>
</If>
</Configuration>
Excel
Note
The .xlam file must be imported zipped as "External template".
To roll out the OneOffixx Excel add-in, the following configuration is required:
<Configuration>
<Path>%APPDATA%\OneOffixx\Excel</Path>
<LockFile>%APPDATA%\OneOffixx\Excel\OneOffixx.xlam</LockFile>
<Shortcut>%APPDATA%\Microsoft\Excel\XLSTART\</Shortcut>
<Cleanup>
<File Path="%APPDATA%\OneOffixx\Excel" />
<File Path="%APPDATA%\Microsoft\Excel\XLSTART\OneOffixx.lnk" />
</Cleanup>
</Configuration>