With TemplafyEvents we are able to run commands based on user actions in the Templafy Task Pane.
Requirements
Path to plugin:
...\SD.Installers\AlloyPlugins\RawPlugins\TemplafyEvents
Copy module from:
...\SD.Installers\AlloyPlugins\ModuleLibrary\Events\TemplafyEvents
And place it in the Modules/events folder of the client solution.
Event types
<event type="TemplafyEvents:documentopen" >
This event will enable commands to run when a document or presentation is opened from the Templafy Task Pane.
<event type="TemplafyEvents:dms" >
This event will prompt a pop-up window and enable users to merge content from a document generated in a Document Management System and a document in Templafy and vice versa.
<event type="TemplafyEvents:assetinserted" >
This event allows commands to run whenever a user inserts assets from the Templafy Task Pane. Assets could be slides, TextElements, images, etc. Notice that it does not work with images in PowerPoint.
<event type="TemplafyEvents:contentupdate" >
This event allows commands to run whenever a user updates the document or presentation through Templafy's Document Content Updater (DCU).
<event type="TemplafyEvents:all" >
This event allows commands to run on all of the above instances.
DMS commands
With TemplafyEvents, we are also able to trigger the Templafy DMS dialog. Not that the DMS dialog trigger is native Templafy functionality, so these commands are only needed in edge cases when the normal docprop trigger can not work. Read more about the native Templafy DMS functionality here.
Two command cases exist to trigger the dialog:
Word
<Cmd case="TemplafyEvents:OpenDmsForWord"/>
PowerPoint
<Cmd case="TemplafyEvents:OpenDmsForPowerPoint"/>
Parameters
areasToInsert
This parameter is only for Word. It decides which areas of the document that should be updated and supports the following values:
Header
Footer
Body
HeaderFooter
All
externalSystemType
This parameter is for both Word and PowerPoint. Define the name of the external system. Information is fed to Templafy statistics.
Start DMS pipe for data
This command starts the data provider for Templafy. It will read key/value pairs first from bookmarks (Word only) and then from custom document properties.
<Cmd case="TemplafyEvents:StartDmsPipeForData"/>
This command makes sense to "prepare" right before opening the DMS.
Stop DMS pipe for data
This command stops the data provider for Templafy.
<Cmd case="TemplafyEvents:StopDmsPipeForData"/>
Start DMS pipe for data (XML)
This command is only for Word. It enables us to fetch data from a XML file and save to custom XML in the document and then call and send data to Templafy DMS to pre-fill forms. It reads all the key/values and returns to caller (CallFunction).
<Cmd case="TemplafyEvents:StartDmsPipeForDataXml"/>
Parameters
XmlElementName
This parameter is required. Define the XML element name tag to spot the line, e.g. "mergeField"
.
KeyAttribute
This parameter is required. Define the name that should be the key for the data dictionary, e.g. "id"
.
FilePath
This parameter is optional. Define the path to the XML file. Default is the same location as document and same name (just with .xml). This parameter also support ability to expand environment variables, e.g. FilePath="%temp%\AcadreMergeDocument.xml"
.
DataPath
This parameter is optional. Define the folder structure that resolves both special-folder and environment variables even though they can be nested. If this parameter is omitted, the folder structure is inherited from the Word document path.
FixedNameDataSource
This parameter is optional. Define the name of the XML data source, which should be loaded from the folder specified in DataPath
. If this parameter is omitted, the name is inherited from the Word document name.
Comments
0 comments
Article is closed for comments.