Customizing Word and PDF Templates for Destinations

When you create a Word or PDF destination, you will see an option to upload your own Word .DOCX template in the Word .docx/PDF Options.

 

 

By creating and uploading your own template, you will be able to make the layout of your submitted form match the original form more closely.  In this article we'll provide an overview of how custom templates work and customization options for certain question types.

Before you start, it is advisable to download the sample template provided on the Add new Destination page, as this provides you with all the placeholders (indicators that dictate which answers need to go where in the document once the form has been submitted) that can be used in your form. Click "Download a sample template".

 

 

Once it has downloaded and opened, it will look something like this:

 

As you scroll through it, you will see the different placeholders available (everything in double curly brackets, including the double curly brackets is a placeholder).

At this point, open a new Word document. In the new Word document, you can set up the form with the headers and footers you'd like to use, and any branding you want included.

Next, you can go on to add the questions to the document in any order you like and copy and paste the placeholders wherever you would like the answers to appear (questions and answers can also be put in tables - you just need to design the table as usual, and put the placeholders where you want the answers to go).

Note: In the event that a question is not answered, the placeholder will be replaced with a blank space.

Font, Size and Color:

If you would like the questions and answers to appear in a particular font, size or color, all you need to do is highlight the questions and placeholders and change the font, size and color. When the form comes through, the answers that have replaced the placeholder will be in the same font, size and color as the placeholder.

Images:

Images added to the form can be resized using size specifications in the placeholder. For example, if your image question placeholder is "{{ fields.image_question }}", and you want the image to appear in 400x200 you can ensure the image arrives at the destination in the size you desire by adding "|400x200" to the end of the placeholder. It will look something like this: {{ fields.image_question|400x200 }}.

Decimal/Integer Questions:

Decimal and integer question placeholders can be edited by adding "|currency" at the end of the placeholder, before the closing brackets. This will make the decimal and integer answers come through with two spaces after the decimal. For example, if the answer is 23.23246, the adjusted placeholder will make the answer come through as 23.23.

Multi-Select Questions:

When a select question has the "Allow Multiple Answers" box checked, and multiple options are selected in the form, the answers come through all on the same line, separated by commas. This can now be adjusted so the answers come through on separate lines, by adding "|each_answer_on_new_line" at the end of the placeholder, before the closing brackets.

Location Questions:

Maps can now be resized using size specifications in the placeholder, much the same as the Image question. So, for example, if your location question placeholder is "{{ fields.location_question }}", and you want the map to appear in 100x100, you can ensure it arrives in that size by adding the size restriction at the end of the placeholder so the placeholder looks like this: {{ fields.location_question |100x100 }}.

Map images can now be set to link to Google Maps. Simply set up the placeholder with the following at the end, before the closing brackets: "|hyperlink: true".

Lastly, location questions can now have their coordinate information's visibility disabled. This can be set by adding "| show_coordinate_info: false" at the end of the placeholder, before the closing brackets. The placeholder will look something like this: {{ fields.location_question |show_coordinate_info :false }}.

Subforms:

When it comes to subforms, you will see the main subform heading among the available placeholders, as well as each of the subform's question's placeholders. You can choose to either have the subform altogether, and use the subform heading placeholder, or you can choose to separate the questions (perhaps include some, but not others, or place them separately in the template), and use the individual placeholders.

Repeat Groups:

Repeat group answers are automatically generated in table format. There is, however, the formatting option "|list", which allows you to list the answers in the group, instead.

Another way you can format your repeat groups is by filtering the questions that you choose to display (this works with the default display as well as the list layout).

The basic way to structure the repeat group placeholder is as follows:

filter_fields: [question_1, question_2]

Sub-groups in repeat groups can be filtered as well by adding the sub section when specifying the fields you want included:

For example, [field1, field2: [subfield1, subfield2], field3]

The placeholder should look something like this:

{{ fields.Group | list, filter_fields: [Question1, Question2: [SubQuestion2_1, SubQuestion2_2], Question3] }}

Lastly, if you filter image and location questions, you can resize the images and maps (the same as mentioned above). For example, your image question's placeholder will look something like this: {{ fields.Group | list, image_size: 300x100 }}, whereas your location question's placeholder will look something like this: {{ fields.Group | list, map_size: 300x100 }} .

Note: New formatting options are only available if you enable the new beta templating. This can be done by checking the box next to where it says "Use new template method". 

Once you're done with designing your Word template, save it and upload it to the Destinations page (by clicking on the "Upload my Word .DOCX template" button).

 

Additional Customization

You can also customize your template by adding a background, logo or adding your company letterhead information if you like.  In addition to that, you can also place the data as you please, in which ever order that would work for you.

The most important thing to remember is that as long as the placeholders are on the template, the data will populate on submission.

This concludes our overview of custom templates for Word/PDF destinations. If you have any questions or comments feel free to send us a message at support@devicemagic.com or leave us a comment below.

Have more questions? Submit a request

Comments

  • Avatar
    Blue Ocean Realty

    It would be great to include a pixel size chart that corresponds to the page output in inches (or cm) H x W.

  • Avatar
    anthony

    Thanks for the feature request!  Unfortunately there are many working parts that dictate the conversion from pixels to inches within a document so it would be difficult to predict the exact measurements.  The best workaround would be to test submit a sample form and measure the size of the image.  Then, tweak the image {{placeholder}}, submit a sample form, and measure the image size.  Repeat this process until you're satisfied.  

Powered by Zendesk