Please wait...

Creating a bulk Word DOCX Report with Multiple Files

Example of a bulk Word DOCX Report with Multiple FilesBulk Word DOCX example

Report Builder is a very useful tool for creating bulk reports from a wpDataTable. When multiple files generation logic is chosen, Report Builder creates a separate file for each table row. Just some cases when this is applicable:

  • Welcome letters or routine notifications for clients, employees, partners.
  • Notifications about e.g. exam results for students.
  • Similar commercial offers to a list of clients.

Let’s see an example. This is a dummy database of clients, where each client has an assigned manager, an account number, etc. Try to play around with the table (filter, sort, etc.) and download several versions of bulk report to see how it changes. You can also change the additional notes to see how the field will change in the generated DOCX files.

wdt_ID Client Manager Name Manager Phone Business Type Account Number
1 Xanthus Wong Lisandra Carey (03927) 4533823 Programming 201-466329507-131
2 Ali Gould Damian Martin (032613) 418327 Planning 214-988824748-758
3 Isaac Riley Leilani Sandoval (06266) 4319834 Engineering 201-486183627-601
4 Xenos Burch Rosalyn Vincent (0135) 55876693 Engineering 201-420453148-998
5 Michael Moss Tucker Murray (016) 80222165 Consulting 214-999563484-497
6 Samuel Knox Ingrid Gomez (0591) 41380580 Engineering 214-913702698-420
7 Eaton Christian Nehru Washington (061) 28432972 Planning 214-931646214-625
8 Brittany Woods Graiden Brown (09502) 2056796 Programming 214-938358045-543
9 Alika Savage George Lawrence (0797) 41443062 Insurance 214-919570900-020
10 Alden Stokes Genevieve Mendez (07428) 5716055 Engineering 214-990688506-173
wdt_ID Client Manager Name Manager Phone Business Type Account Number

Bulk Word DOCX Generator for WordPressBulk Word DOCX generation process

I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Let’s see what steps are needed to prepare such a report.

1. Prepare the source wpDataTable.

Report Builder is an add-on for wpDataTables, so first step is to prepare a wpDataTable with data.

For this example we created a table in table constructor with the following columns: “Client”, “Manager Name”, “Manager Phone”, “Business Type”, “Account Number”.

See how to create tables like this in Table Constructor.

2. Prepare the DOCX template for the report.

Prepare a new DOCX file that would be used as a template for each of generated files. In our case we used in the report:

  • Predefined variables: ${generatorname}, ${today}
  • Additional variables: ${additionalnotes}
  • Cell values from wpDataTable: ${client}, ${businesstype}, ${managername}, ${managerphone}, ${accountnumber}

To download the template we used in this example click here.

See here the full list of rules on creating Report Builder templates.

Please be careful when you enter the cell variables. When you are creating multiple files from rows, in Cell values from wpDataTable you need to enter variables without .all. In that way Report Builder will create a separate Excel file for each row and compress it in a Zip. If you enter variables with .all the Report Builder will create a single report for all table rows.

3. Create a report in WordPress admin page through Report Builder Wizard.

Go to WP-admin, open ReportBuilder -> Create a new report

On the first step choose the source wpDataTable:

Bulk Word DOCX Report

On the next step provide the report name, choose ‘Multiple file’ generation logic (which means we’ll create a separate file for each row), tick “Follow table filtering”, set the generated filename mask as “${client}-welcome” and define one additional variable – “additionalnotes” with some default value:

Bulk Word DOCX Report

Then upload the template that you have prepared (click “Browse…“, drag&drop the file, click “Use template”):

On the next step you can download the preview for X first rows of the table:

DOCX Generator for WordPress

If you are satisfied, you can click “Save Report” to store the result, if something is wrong, you can go back in the wizard and change the settings or upload a different template. Once you click “Save Report”, you will see the shortcodes for this report:

Bulk Word DOCX Report

The shortcodes contain buttons for downloading report, saving report to WP Media Library, and for inputs for additional variables.

You can copy these shortcodes directly from this page by clicking on shortcode button, but this isn’t necessary as you can always generate these in standard WordPress post/page editor, or in Visual composer.

Once you close the wizard you will be redirected to the Browse page. You can always quickly download the report (for the whole table) from there by clicking the “Download” button, or quickly get the list of available shortcodes.

The last thing to do is to insert the Report controls to the post or page where you need them, so the users would be able to use it:

  • See here how to insert the report builder controls to the post or page using standard WordPress Visual editor.
  • See here how to insert the report builder controls to the post or page using Visual Composer.