Create a new Docentric template based on a PDF sample document

You can design Docentric templates in many ways. If you are all about beautiful designs, you will probably hire a professional designer to do it for you. But there are other approaches as well, and our customers sometimes decide to develop a new Docentric template that looks similar (or even exactly the same) as an existing report that’s already in use. The challenge here: this existing report is output from another reporting software solution, such as SSRS, third-party reporting solution for D365FO or even legacy ERP in case of the new D365FO project.

Docentric designs are just ordinary Word documents edited in MS Word. They are also tagged with data-bound placeholders to make some of their parts dynamic. These placeholders are managed by Docentric Designer, a special Add-In for MS Word.
When you create a new Docentric template, it is a good practice to separate the task of designing the template from the task of bringing the report data source elements to that design.

We will take a look at the most common scenario, when we have a PDF document as a report example at our hands and we want to replicate it in the Docentric template. The main challenges are to replicate the layout (position of the various content elements on the page) and fonts (types, colors, sizes, etc.).

Docentric templates are designed in MS Word, so there are two possible approaches:

  1. Convert the sample PDF into MS Word document, and
  2. Create a new MS Word document from scratch.

Approach #1: Convert the sample PDF into MS Word document

It is intuitive to start by converting the available PDF into MS Word document. There are many tools available for this task, the most obvious being MS Word itself. While MS Word is a powerful application with numerous strengths, we cannot say that opening and reading PDF documents is among them. Generally, there is a little chance we will be satisfied with the result, because the layout structure could be – well… just not as it was originally meant to be.

Let us take a quick look at an example of a simple invoice, where PDF file (left) was directly opened in MS Word (right):

If we are very lucky, the layout will be correct, but usually it won’t. In the above example you can see all types of problems: everything is mixed up and completely useless as a starting point for the layout. Obviously, we can’t rely on simply importing the PDF into MS Word but note that there is still a lot of useful content here.

First, we can identify the distinct layout blocks that are completely correct. We can reuse the document header with the legal entity info, invoicing address block and the whole table with invoice lines, including the table formatting (shading and borders). The font-related information has been completely preserved and can be used as a reference as well. Note that there are no common rules, every case will be different, and you need to use your own judgement when analyzing the result and deciding on what you can reuse.

Convert PDF into DOCX format with alternative applications

Fortunately, many other applications will produce much more accurate result when converting a PDF into docx format. This could be a topic for a separate article, but to summarize: each of the tools on the market (no matter if free or paid products) will generate different results, which will suit your needs up to a certain level.

Below you can see the results from the following tools:

  1. PDF Element
  2. TalkHelper
  3. Nitro Pro
  4. Adobe Professional

 

 

The most correct layout was produced by TalkHelper, but for the price of quite complex table structures, which would be difficult to maintain. My personal favorite in this case would be the Nitro Pro result. It seems that one could simply take this file, make some minor modifications and have a good starting point for the next step, replacing the sample values with the dynamic content.

Approach #2: Create Docentric template as an MS Word document from scratch

Even if you do not get an approximately acceptable result with the first approach, you would still keep its result at hand. You would then open a new blank MS Word document, copy-paste the already mentioned reusable blocks from the first document and then manually make the other necessary adjustments in the new Word document. It can’t be too hard once when you have a PDF sample in front of you and know what the result of your work should be.

The next step: Bring report datasource elements to the template

Once you have a sample Word document with the correct layout and formatting, you can start adding the report datasource elements to it. You would typically want to replace certain parts of the static content with the dynamic content, which is done with the help of so-called tagging elements. Before we can start using the tagging elements, we need to turn our sample Word document into a working Docentric template by clicking the Use As Template button in the Docentric AX ribbon, which you will see once you install Docentric Designer.

Be sure to have a DDSP file ready and import it as a data source for this template. Learn more >>

Converting any part of the document into the dynamic content is easy. Instead of the static content we insert one of the tagging elements for which we need to provide the binding source, usually a data field, data record or expression based on the available datasource. We can perform this process in two ways:

  1. First locate the binding source in the report datasource, then select the tagging element to which we want to bind it, or
  2. First select the tagging element, then specify the binding source.

We will use the first way in our example and for that we need the Quick Builder pane (if it isn’t visible, click the Quick Builder button on the Docentric AX ribbon to open it). Quick Builder is a smart tool that allows us to quickly locate the data fields in the report datasource and insert the corresponding tagging elements to a template.

In the Quick Builder pane, you will find a structured data schema with three sources: Parameters, MainData and GeneralData – (see highlighted below). Each of these sources contains an expandable data structure which typically consists of data records and data fields.

Select the static content that you want to replace by the dynamic content, then search for the matching dynamic content (data field or data record) in the data schema and insert the adequate tagging element based on the identified dynamic content. Let us now see Quick Builder in action on a few examples.

Document title

We will start with an easy example – document title. Instead of the static content “INVOICE”, we want to bring the dynamic content from the Parameters/DocumentTitle data field. To replace it, we select it and simply head over to Quick Builder, select Parameters as source, then locate the DocumentTitle data field there. Just right-click on it and from the context menu which lists all the supported tagging elements select Add Field in order to add the field tagging element to the design, that is bound to the Parameters/DocumentTitle data field.

Customer name

In the next example, we will insert a field tagging element bound to the MainData/SalesInvoiceHeader/InvoicingName data field in place of the Customer name.

Logo

In the third example, we will be editing the header of the document. Select the place where you would like to insert your company logo, and then locate the GeneralData/CurrentCompany/Logo data field, right-click it and from the context menu select Add Image in order to insert the image tagging element bound to the company logo data field.

These are however only a few simple examples of how to design a custom Docentric report template. Please find further detailed instructions in our online tutorials.

When satisfied with the result, upload (attach) this template to D365FO. Learn how >>

Leave a Reply

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

*

Docentric respects your privacy. Learn how your comment data is processed >>