Document Merge Templates

Word and PDF documents are great tools for creating nicely-formatted documents. There are times when you want to present information from docMgt in one of those nicely-formatted documents. Sometimes manually and other times as part of a workflow. This is where Document Merge Templates come in.

One example is a certificate of completion. In this case a user might get a PDF of a certificate emailed to them once they completed their training. Another example is a welcome letter. Here a letter welcoming a new employee could be generated and emailed to them. One manual example would be a printable envelope. Whenever you needed to print an envelope from a record you could manually merge an envelope template.

 

Merge Document Options

Document merging is simply described as merging content from docMgt into pre-formatted documents. These documents can be Word (*.DOCX), Adobe (*.PDF) or Excel (*.XLXS). The concepts for dealing with each are similar but the techniques a slightly different. We will explain each in this article. Each document type you make “merge-able” is considered a template. We will explain how to create each template type and how to make them available for users in docMgt.

 

Before We Begin

To get started you need to install the docMgt Windows Add-Ins from your docMgt site. Log into your site and click the “user” button on the top right of the toolbar.

 

From there click the “Integration Add-In” button to start the download.

 

Once downloaded, run the installer and make sure “Word Add-In” is selected. Finish the installation then follow the next steps.

 

 

Word Templates

Word documents are the primary template type. They are the easiest to set up and are usually the go-to type. They are the primary type because not only are they easy to deal with but they can be converted to PDF during the merge process. So, whether you want DOCX or PDF output you can start with Word. Also, since the Add-In we will be using for all template types is implemented in Word, we have everything we need in one place.

 

Starting a New Template

Start Word and open a blank document. Then navigate to the “Insert” tab on the ribbon. There you will find the docMgt group of controls. Use the “Log In” command to log into your docMgt site from Word. Once you are logged in some other controls will appear in the docMgt group.

 

The first thing you will want to do is create a “Library” that corresponds to the record type you are working with. Creating a Library gives you a way to associate several merge templates with your record type. This tells docMgt when to make these templates available to users. For instance, if you added a library for your Personnel record type then users viewing a Personnel record will see the available templates. Click the “Select Library” button, click “Add New Library” then select your record type from the list. You can type in your own but it is best to use the list. You can change to another library using the same “Select Library” button.

Once you have selected or created your library you will see 3 options available – “Fields”, “Snippets”, and “Templates”. Fields allow you to place field markers into the document that will be replaced with data when they are used. Snippets allow you to build paragraphs that can be placed into your templates (we will talk about these in a future article). Templates are the list of merge templates available.

For this example, we are creating a new merge template so in your blank document add some text. Let’s use the Personnel example and create a welcome letter. It can be a very basic “welcome to the company” type letter. Add a header and some introduction text. In the body make sure to refer to their position and hire date. We will merge those in later. When you have a little bit of that text you can stop there. From the Insert /docMgt group click Templates and select “Create New Template from This Document”. In the dialog that appears enter values for the Category, Sub Category (if desired) and Name. These values will be used to tell docMgt how to store the generated documents in your Records at merge time. Once you click OK the template is now available for your users.

Log in to your site using your browser and go to a Personnel record. You will see a button on the documents toolbar that reads “Generate New Form” when you hover over it with your mouse. Click this to see the forms available for this type of record. The first tab is the list of E-forms and the second tab is the list of Merge Forms. In the Merge Forms list, you should see your template. Click that and it will merge the document into your record with the record’s data. If you wish the system to save the document as a PDF just click the “Save as PDF” checkbox before you click the template.

That is it! You should now have a new Word (or PDF) document in your record that was based on your merge template.

 

Changing and Existing Template

If you wish to change your template, go through the same process to start Word, go to the Insert tab, Log In (if not already logged in) and select your Library. When you have your library selected, click the Templates button and select the template you wish to edit. Simply make the changes needed and click the save button in Word. The system will file the new version away for you automatically by replacing the old one.

Download the Word Templates Used in Article

Merging Images in Word

Merging images into a document requires that you first insert a blank or temporary image in the place where you want your merged image to go. This allows you to size and place the image exactly where you want the merged version to go. Right-click on the picture and select Format Picture option. From the Format Picture dialog select “Layout & Properties” (the 3rd icon). Expand the “Alt Text” section and use the “Title” property to do the following.

To merge an image of a document from the record

In the Title property, use the format “IMG:Name|PageNumber|Annotations|PreserveSize|Category|SubCategory” to pull an image from the record. The image will be a rendering of the selected document. For instance, if the image you select is from a Word document then a picture of that word document’s page will be put into your merge document.

  • Name = The name of the document to merge into the PDF
  • PageNumber = The page of the document to use (defaults to 1 if left empty)
  • Annotations = Boolean that specifies whether or not to use the Annotations in the image (defaults to True if left empty)
  • PreserveSize = Whether to keep the image the same size as it is drawn (defaults to True if left empty)
  • Category = The name of the category to find the document to merge into the PDF
  • SubCategory = The name of the subcategory to find the document to merge into the PDF

 

As an example, if you want to put an image of page 2 from the document in the “Checks” category and “2020-07-01” SubCategory with the name “Latest” then you would use this string:

IMG:Latest|2|False|False|Checks|2020-07-01

To merge a signature from the record data

You can also use record data to merge an image. In order to do this you must have properly -formatted image data saved into the Record. This is common for signatures where you save an E-form’s signature field to the Record. The image data will start with text something like “data:image/png;base64,“. This represents a base64-encoded image that is stored as a string and we can use it to place the image into the merge document.

In the Word image’s Title property, use the name of the field in brackets to merge that field’s data into the image. It will look something like this:

[Signature]

 

 

PDF Templates

PDF templates are similar to Word template except you need to use Adobe Acrobat (not the reader) to make them. They are mainly used for form-oriented merging like a W9 or some other precisely laid out official form. They are less flexible than Word forms for inserting text into the middle of paragraphs because you are limited to using PDF Fields to hold your data. If you want to have a PDF output of a letter where your text is merged into the sentences, we would suggest using Word and having the system convert it to PDF for you.

Open your PDF in Acrobat and use the Tools / Prepare Form option. Adobe will attempt to place fields where it thinks they may belong. When it is done you can then remove those automatically placed if needed and place your own. On the “Prepare Form” toolbar in Adobe you will see a series of field types. Click on the “Add a Text Field” button and then click on the document where you wish to place your data. Name the field the same as you named the field in docMgt.

This is how docMgt knows what data to place in each field – by its name. If you need to place more than a single docMgt field into a PDF field you can also use variables. For instance, to place “FirstName” and “LastName” from docMgt into a single PDF field use the name “[FirstName] [LastName]” (no quotes). This tells docMgt to concatenate the first and last name into your PDF field.

If you wish to place check boxes and have them checked if a certain value is set in docMgt, use a variable that returns 1 for checked and 0 for not checked. Actually “Yes”, “True” and “1” will work for checked and anything else will not check it. Here is an example to check whether the Status field in docMgt is set to ACTIVE – [IF([Status]|=|Active|1|0)].

Once you have your fields placed, the next thing to do is to add it to your library in docMgt. To do this, use the Word Add-In we used above and when you have your library, select Templates and then select “Manage Templates for the Selected Library”. Click the “Upload New Template” button and navigate to your PDF and select it. Give it a name and click OK. Once it saves you will then be able to edit it to set its Category, Sub Category and Name like we did for the Word template.

Log in to your site using your browser and go to a Personnel record (assuming you filed this template away in the same library).  In the Merge Forms list you should see your new template. Click that and it will merge the document into your record with the record’s data just as before.

That is it! You should now have a new PDF document in your record that was based on your merge template.

If you make changes to the template and want to update it on the server, use the “Manage Templates for the Selected Library” option in Word, select the template to update from the list then click the “Upload Template” button to find your updated PDF and upload it.

Download the PDF Templates Used in Article

 

Merging Images in PDFs

 

Merging images into a PDF document requires that you first insert a blank or temporary image in the place where you want your merged image to go. This allows you to size and place the image exactly where you want the merged version to go. Go to the picture’s properties and set the “Name” property to point to the image you wish to merge.

NOTE: If you are using docMgt 3.35 or higher then the format of the strings are the same as the Word method above – i.e. using either IMG: or field name in brackets. The old method (below) is still supported but no loner recommended.

If you are using docMgt 3.34 or older then read this section!

To merge an image of a document from the record

In the Title property, use the format “DOC|Category|Name” to pull an image from the record. The image will be a rendering of the selected document. For instance, if the image you select is from a Word document then a picture of that word document’s page will be put into your merge document.

      • Category = The name of the category to find the document to merge into the PDF
      • Name = The name of the document to merge into the PDF

As an example, if you want to put an image of the document in the “Checks” category that is named “Latest” then you would use this string:

DOC|Checks|Latest

To merge a signature from the record data

In the PDF image’s Name property, use DOC||[FieldName] to merge that field’s data into the image. It will look something like this:

DOC||[Signature]

 

REMEMBER That this is the OLD method. For newer system please use the IMG: method described above in the Word section!

 

Excel Templates

Excel spreadsheets are wonderful for building charts from your data. With docMgt you can now merge your data into a spreadsheet just like you do with Word and PDF. All you have to do is add variables to your spreadsheet that match the values in docMgt. For instance, if you want to place the employee’s name in a cell you would enter [Name] in the text where you want the name to show up. Same for all other variables.

Once you have your fields placed, the next thing to do is to add it to your library in docMgt. To do this, use the Word Add-In we used above and when you have your library, select Templates and then select “Manage Templates for the Selected Library”. Click the “Upload New Template” button and navigate to your XLSX file and select it. Give it a name and click OK. Once it saves you will then be able to edit it to set its Category, Sub Category and Name like we did for the Word template.

Log in to your site using your browser and go to a Personnel record (assuming you filed this template away in the same library).  In the Merge Forms list you should see your new template. Click that and it will merge the spreadsheet as a document into your record with the record’s data just as before.

That is it! You should now have a new Excel document in your record that was based on your merge template.

If you make changes to the template and want to update it on the server, use the “Manage Templates for the Selected Library” option in Word, select the template to update from the list then click the “Upload Template” button to find your updated XLSX file and upload it.

Download the XLSX Template Used in Article

 

 

Please Rate this Article

Join Our Mailing List

Join our mailing list to receive the latest news and updates from the docMgt team

You have Successfully Subscribed!

Pin It on Pinterest