Canopy
Canopy

Building document templates

Document templates for reports and statements of work (SoWs) is a key function of Canopy. This section is dedicated to helping you understand the templating process and to provide you with all of the knowledge you need to build your own templates.

In order to generate Word reports from Canopy, a document template must be mapped. This article provides information on how to achieve this.

Contents:

Requirements

The following requirements are necessary to work with the Canopy templating solution:

  • Microsoft Word is our choice for template design. Microsoft Office provides the concept of content controls to facilitate inserting data from external sources into Word documents.

  • Canopy only supports the OOXML standard - i.e. Microsoft Word 2007 onwards. This means Canopy cannot use the Word 2003 format for template design.

  • The Canopy plugin for Word works on Microsoft Office 2010 - 2016 (Windows only).

  • Appropriate access to Canopy is required. Template building is not available for all user roles.

Common terminology

Document templates (reports and SoWs)

A “form” built in Canopy (Templates → Reports or Templates → Statements of Work), which acts as a container for document-specific fields, default content (for those fields) and storing (via upload) of Word templates.

Word template

This is a Word document that has been linked to different fields that are available in Canopy (known as mapping). The mapped Word template can combine static headers, text, images (e.g. cover pages, headers, footers) and so on, dynamic data via linked fields to Canopy (the data source), custom logic (repeats and conditionals), and also charts.

Canopy mapping plugin

This is a Microsoft .NET Office plugin used for assisting with the setting up data points from Canopy within a Word template. These data points are inserted a Content Controls - which contain XPaths - to the Word document. It can also be used for adding repeats and conditionals.

Mapping (Word document setup)

The process of linking data fields in Canopy to a Microsoft Word document using the Canopy mapping plugin and the XML mapping document.

Microsoft Content Control Framework (CCF)

Canopy utilises Microsoft’s CCF (also known as Structured Document Tags). CCF is a proposed improvement over the previous fields and mail merge solution used to automate Word document generation. We have extended some of the base CCF types to allow them to perform additional functions that are not currently supported by Microsoft (e.g. converting from XHTML to WordML, chart data merging and so on). For background information, see: https://docs.microsoft.com/en-us/visualstudio/vsto/content-controls?view=vs-2017

XPath

XML Path Language is a query language for XML documents. Canopy currently uses XPath 1.0 syntax. For a sample guide, see: http://zvon.org/comp/r/tut-XPath_1.html