Create a Word/PDF in ER (I)

In this series, I’m going to explain the process of creating a Word document in Electronic Reporting (ER) or a PDF, as it can easily be converted to PDF using the ‘Electronic Reporting Destination’.

In this post, I’ll be focusing on the format, as the model and the mapping are generic. This method is valid for either a newly created model and format or for extending generic Microsoft electronic reports where the format is created from scratch.

I’ll be creating a Word document containing information about a product and its variants. The document will include a header, a table with all the variants, and a footer. I will be starting with this model and mapping structure:

Let’s create the Word format:

Selecting ‘Designer’ and with the ‘Format’ tab selected, we can start by ‘Add root’. We are going to select ‘Excel / File’ because ‘Word’ is not available:

A form will open where we need to give it a name and upload a template. The template can be the file with the final design or an almost blank Word document (I have encountered some bugs when uploading a completely blank Word document, so now I just write something in it to avoid these issues).

Let’s create a new file type. The name might differ in your environment. If you don’t have any file types available, you can create one by navigating to ‘Organization administration / Document management / Document types’.

Now let’s create the structure of the Word document. We’ll be working only with Ranges, either to keep it clean or because it’s a repeating node, and with cells. We don’t need anything else:

Let’s start by the header (Range):

I always use the same name for both ‘Name’ and ‘Excel range’.

For the fields in the header (Cells), I leave the data type as ‘Void’.

For the variants range, we’re going to add replication:

This is the finished format:

Now we can start linking it to the model mapping, except for the labels and the footer, where we’ll be using translatable labels:

Translatable labels

That’s all for now! In the next post of this series, we’re going to see how to add these nodes into the Word document.


Posted

in

, , ,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *