Core Docs - Core Concepts - Creating a Merge Document

Rock Version: v20.0
Last Modified: 2026-04-06 3:59 PM

As mentioned previously, Rock currently supports two different merge document formats: HTML and Word. Below we cover how to create a merge document for each format.

Word

The most common document format is Word. Creating these documents is actually pretty simple. Before we jump in it's important to talk about the two strategies for merging using Word.

The first strategy is to create a Word document where the whole document acts as a template for each record. This is most common for things like letters.

With this type of document, you can simply open Word, type your letter and then add in the Lava where you want the dynamic text to show.

You have access to several Lava functions in Word. So, things like {{ 'Now' | Date:' MMMM d, yyyy ' }} will add the current date and time. You can also print data using the "Row" format, as in {{ Row.NickName }}. That pattern should get you most of what you need. You can additionally add in variables (like {% assign now = 'Now' | Date %}) and then print those variables. All of the Lava tags work except ifraw, and lava, while none of the Lava commands or Lava Shortcodes will work.

The second merge document strategy is for occasions when you want more than one record to be displayed on a single page. This is often the case for tasks like creating mailing labels. When creating these types of documents add a {% Next %} code to move to the next record in the list.

Rock will automatically figure out what strategy your document is using so there's no extra configuration.

HTML

You might be wondering, "Why would I ever want to use HTML for a merge document?" At first blush it does seem a little odd. HTML, however, is a great tool for incorporating rich media into a format that can easily be printed. It’s often the best choice when you need to print a report that requires showing maps (easy to display using Google's static map API) or person photos (links to their photo in Rock).

Below is a quick example of some HTML/Lava that will present a list of people with their photos (this assumes that the merge document is passed a list of people).

1   
2       
3   		Group Roster
4   		
5    	
6    	
7    	
8    	    
9
10 11 {% for row in Rows %} 12
13
14 15
16
17

{{ row.FullName }}

18 {{ row.Email }}
19 {% for phone in row.PhoneNumbers %} 20 {{ phone.NumberFormatted }} {{ phone.NumberTypeValue.Value }}
21 {% endfor %} 22
23
24 {% endfor %} 25 26
27
28 29

Note a few things in the code:

As you can see, creating HTML merge documents is easy. Here are a few additional tips:

Cloud Flare
Enabling Scrape Shield with Cloud Flare will block email addresses in HTML merge documents. If you're using this service, it will need to be disabled.