Create Word (DOCX) Documents

Uploading/Creating a DOCX

If you are using a DOCX file as the template (you uploaded a DOCX file), then you will want to use the same formatting for the fields as you do in our Builder ( {$Fieldname}, {$AnotherField}, etc). 

Make sure to use unique names for each field name. Do not use numbers on their own (eg '123') or include spaces, punctuation, special characters, or hyphens in the field names to ensure an easy integration process..

Click here to download an example Word document.


Updating your DOCX

If you need to make changes to your uploaded DOCX file, simply edit the file on your computer then re-upload it to Formstack Documents.  At this time, you cannot modify a DOCX file from inside Formstack Documents.

To get started, simply login and create a new document! If you are uploading a document, please make sure you are using a file with .docx extension.


Table Row Loops

If you're generating an invoice, you're probably looking to create a table that loops through each of the line items and prints them on a new row in the table.  No problem!  We've added a new "tablerow" tag that you can use and it tells our system to treat the table row as a loop.  The tag works exactly like a "foreach" loop, so all you need to do is use "tablerow" instead of "foreach" and we'll handle the rest.

Here's an example:


The data that you send through to a table row loop needs to be an array (ie and array of products) that can be easily looped through.  The part after the dot in the variable name is the individual property for that element in the array.


Spacing Issues

If you are experiencing issues with missing spaces in your merged documents, we've got a fix for you.  Inside Word, open up your template, then go to File > Options, then click on the Trust Center, and click the Trust Center Settings button.



In the Trust Center Settings, click the Privacy Options item on the left, then on the screen, you'll want to uncheck the option that says "Store random numbers to improve Combine accuracy".



Go ahead and save those settings, save your template, then upload to Formstack Documents!



Was this article helpful?
16 out of 21 found this helpful


  • 0
  • I've created a word document that is basically a big table generated by a new survey response from SurveyMonkey.

    One of the table fields will end up being quite big: 5 different responses depending on the answer, each with a bit of text.

    On my test merges, the tables don't resize themselves to the text that is shown, they keep the full size of the merge field, even the bits that aren't in the final document.

    Is there a way so that the tables automatically resize themselves to the correct size?

  • Hi Tech,

    In your Table Properties in Word, there should be an option to auto-size the columns to fit contents. Please enable that option and it will resize the table automatically.


  • Hi Jeremy,

    That didn't work, but selecting all the rows of the table and unchecking the "specify row height" option worked, as did unchecking "Allow row to break across pages" thanks for the response.

  • Hi Jeremy,

    When working with data from ESRI's Survey123, do you know what the text string to use to have data merge into a docx? i.e. from Zerion's iFormBuilder we use {$_0.record.columnname}.


  • Hi Bill,

    If you turn on Debug Mode ( you can see the fields that are being sent over and what merge fields to use.


  • Hello Jeremy,

    we tried to upload a pdf file or create a template with your document builder but haven't been successful. We are a Tour oeprator and we like to create a travel offer to our client using a data base to power our PDF . it look like web merge could help us create those form via your platform. We are just concern that there is no customer service and so fare we didn't succed on creating a pdg with the trial version.
    Please give us some guidance. any phone number we could reach you ?

    Lionel Pavel Alter

  • HI Lionel,

    Please email our support team at or click the button at the top of the screen to create a support ticket. We'd love to help! If you read any review of WebMerge, you'll see everyone raves about our support :)


  • Lionel: I just wanted to weigh in and say Jeremy's telling the truth! WebMerge support has always been very helpful to us. Hope you have as good an experience with the product as we have.

  • I agree Arlo. Jeremy and team has always been very responsive we need assistance.

  • Hi,

    Hope all is well.

    I've already removed the mapping and document from Test mode but when I'm trying to generate a PDF/WORD document from Salesforce, I'm still seeing the Webmerge watermark logo. Can you kindly help me to solve the issue?

    Your help will be much appreciated. Thank you.

  • Hi George,

    Please check your Data Routes too and make sure those are set to Active (not Test Mode). Somewhere in the process, something is in Test Mode :)


  • Hi Jeremy, I did the merging of my Word 2016 document with data was captured by the form created in the builder. Everything works well except checkboxes. When I check several checkboxes in the form (for example several printers). After the merging, I can see in the document only the word "array" instead of printers' names. The same situation with all cases where I use checkboxes.

  • Hi John,

    Try using implode() like this in your template to create a comma-separated list from the array:

    {implode(", ", $FieldName)}

  • Hi Jeremy,

    I am using Formstack and have a number of radio buttons and check boxes where an "Other" [user generated answer] can be added. How do I code their answer to "Other" into a word document?

    Many thanks.

  • Hi Alex,

    Formstack is going to send over the value like this:

    Other: Text Here

    So in the Word document, if you wanted to make a selection with an X you could do this:

    {if strstr($FavoriteColors, "Other:")}[ X ]{else}[ ]{/if} Other

  • Thanks, Jeremy. I will try this out shortly.

    I have unfortunately another issue. It involves adding spaces between two names. What I want to do is allow a person to choose to have either their last name first or last with a radio button depending on their country's convention.

    This seems to work OK, however, I cannot add spaces in the fields between their names. The code I have used is:

    {if $name_order == First Name, Last Name}{$firstname} {$lastname}{else}{$lastname} {$firstname}{/if}

    The error I get is: "Spaces are not allowed in your merge field". How do I create one space between separate fields in an if/else command?

    I've had a look on smarty and cannot find any commands to do this.

  • Hi Alex,

    You should use this:

    {if $name_order == "First Name, Last Name"}{$firstname} {$lastname}{else}{$lastname} {$firstname}{/if}

  • Many thanks, Jeremy!


Please sign in to leave a comment.