When you compose a Word template using BoostSolutions’ Document Maker, you can pull data from the current SharePoint list fields, also you can pull data from related list fields which are lookup from another list.
This article will explain how to insert related list fields in the Word template from another list.
The values of related fields are shown in the document
And this is a SharePoint list named as Customers, the list includes these columns and items as following.
Firstly, download the trial version of Document Maker and install it to your SharePoint server.
And then install Document Maker add-on in Word application.
Navigate to Sales-Record list.
Or, in the List Settings page, click Document Maker Settings under General section.
In the Document Maker Settings page and click Create new template.
When the create a new template dialog appears, type a name for it, such as invoice template, and then click OK.
And then the Word template opens, you will find that fields of Sales Record list are listed on the left panel as following.
The fields [Customer: Contact], [Customer: Contact Email], [Customer: Country], [Customer: Phone] and [Customer: Street Address] are additional fields, to show or insert them in the template document, you have to select them in the Additional Fields section in the Lookup column.
In the invoice template, we compose the content as following.
In the template, move the cursor to the header and insert these list fields in the template as following.
Then, we insert other list fields [Product], [Quantity], [Unit Price] and [Ext Price] into other positions in the Word template as following.
Now, a Word template is done. When you generate the document based on this template, the corresponding values of list fields will be inserted into the specified positions.
Save the template and click Word application. And then you will find a template is created in the Document Maker Settings page as following.
In the Document Maker Settings page and click Rules on the left panel.
And then click Add rule.
In the Add rule page, specify a name this rule, such as rule for invoice.
In Select Template section, select Invoice template, which means that the document will be generated using this selected template.
In Naming Rule section, specify the name as following.
In Date Format section, select (Default SharePoint Format). The date format for the generated document will be same as the SharePoint format.
In Output Types section, select PDF. The document will be generated as PDF file, you can also select other output types.
In Distribute Document section, select Save as attachment option, which means that the generated document will be saved as attachment to the corresponding item.
In Merged Document Generation section, unselect Enable option.
Click OK to save the settings for this rule.
And then, you will find that a rule is created in the Document Maker Settings page.
Navigate to Purchase-Orders list, select one item (20170111-143), under ITEMS tab and click Generate Document in Document Maker group.
When Generate Document dialog appears, in Template section, select Invoice template. In File Name section, you will see that the file name is generated based on the rule as following.
Click Generate button. Wait for a few seconds, and then the document is generated in PDF format as following.
Here, click Download to save the generated document to local computer and check the generated document.
In the document, the values of related fields are shown in the document as following.