Report Builder can come in handy when you just need to allow users of your site to create some kind of document on-the fly (i.e. contract, CV, letter of attorney, etc.). These documents do not really need any data source, they can be based on front-end user input, and make you and your site visitor’s life easier by filling in all the dynamic parts in a document.
Please take a look at this example – a dummy used car sale contract generator. Change the values in the inputs, and download the generated file to see how it works:
Creating such a report is very easy:
1. Prepare a DOCX template file.
If you want to generate a document that you already use in your everyday routine, you probably just need to modify a template that you already have. Only thing you’d need to adjust is to place variables instead of the blocks that need to change.
For this case we used these variables: ${sellername} (Name of seller), ${sellersin} (SIN of seller), ${buyername} (Name of buyer), ${buyersin} (SIN of buyer), ${caryear} (Car manufacture year), ${carmake} (Make), ${carmodel} (Model), ${exteriorcolor} (Color of exterior), ${interiorcolor} (Color of interior), ${vinnumber} (VIN), ${odometer} (miles on odometer), ${price} (Price), ${paymenttype} (Type of payment), ${documents} (list of documents), ${additionalnotes} (Additional notest to be added to the contract), ${witnessname} (Name of witness), ${today} – predefined variable to place today’s date.
To download the template for this specific example click here.
To see full list of rules for preparing templates click here.
2. Create a report in Report Builder Wizard.
Go to WP-admin, open ReportBuilder -> Create a new report
On the first step do not choose any wpDataTable (just click “next”, leave “None (skip)” selected):
On the next step (“Settings and Variables”) we need to provide a report name, and add all the variables that we used in the template, optionally providing default values (default values can be blank):
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 of the report (all variables will use the default values) to see if everything works correctly. If it doesn’t you can go back a step or two to modify the settings.
Once you click “Save Report”, you will see the shortcodes for this 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: