- 22 Aug 2024
- 2 Minutes to read
- DarkLight
Templates
- Updated on 22 Aug 2024
- 2 Minutes to read
- DarkLight
General
Every template of a Microsoft Excel Report is a Microsoft Excel Workbook; each of these Microsoft Excel Workbooks can have standard, static content (text, images, a table of contents etc. - every content that is supported by Microsoft Excel); wherever you want Mail & Deploy to add data to the report document dynamically (e.g. a table from a Datasource, you can reference an Element within the template; this reference will be replaced by the actual content of the element when a report document is created from the report.
Properties
Every template has the following properties:
Name | Description |
---|---|
Name | The name of the template. |
Managing Templates
Templates can me modified by opening the report in the Report Designer: To create a new template or import an existing Microsoft Excel Workbook as a template, right-click the Templates folder in the content explorer and choose *New Template * or Import Template. To edit the contents of a template, double-click the template item in the content explorer. To delete an existing template, right-click the template item in the content explorer and click Delete Template.
Single-Template Operation
If the Microsoft Excel Report has only one template, that template will always be used when a report document is created from the report. In that case, the Template Name(s) property of the report can be left empty.
Multi-Template Operation
Mail & Deploy supports multiple templates per Microsoft Excel Report and can merge templates to one large template at runtime.
Example: Suppose you want to create a sales report and you create three templates named Title Page, National Sales Data, and International Sales Data. You want to create one report document per sales representitive from this report; however, not all sales reps have international sales. In that case, you can dynamically (depending on a whether the sales rep for which the report document is created) decide whether all three templates or only the first two ones shall be merged and used for the creation of the report document.
If you have more than one template for a report, you need to specify the names of the template to be used for the creation of the report document in the Template Name(s) property of the report. The order in which the expression returns the template names is the order in which they will be merged when creating the report document.
Examples
The following Expression can be used in the Template Name(s) property of the report to create the report document from a single template named Title Page:
"Title Page"
The following Expression can be used in the Template Name(s) property of the report to create the report document from two templates named Title Page and National Sales Data:
CreateList("Title Page", "National Sales Data")
Let's suppose you have a Datasource named Sales Data and three templates named Title Page, National Sales Data, and International Sales Data. Depending on the value of the datasource field HasInternationalSales the report document shall either be constructed with or without the *International Sales Data *template. The following Expression can be used in that case:
If([Datasource].[Sales Data].[Field].[HasInternationalSales] = 1, CreateList("Title Page", "National Sales Data"), CreateList("Title Page", "National Sales Data", "International Sales Data"))