Generating the output based on a docx template
Last updated
Was this helpful?
Last updated
Was this helpful?
To generate the Docx output firstly we need to select “Docx” as File Type in the Export Data option.
Initially we need to upload our docx templates at Datasource level (under Custom Excel)
The variables which we want to show in the output documents need to be set in the post query of the datasource using data.set(“variableName”,”variableNameValue”) method.
In Docx templates variables that needs to be populated should be shown as ${firstrow.variableName}
If any bookmarks are needed in the output. Firstly we need to create a bookmark in template.
Select the content then click on Insert -> Bookmark -> Add
Visibility of the bookmark needs to be maintained in the post query of the datasource using data.set(“bookmarks.bookmarkName”,”Y/N”) method. (Here “Y” when you want to make the bookmarks as visible and “N” if you want it to be hidden.)
If there are any nested bookmarks in your template , visibility of those also needs to be handled in post query.
If we need any formatting for number, Date, Amount etc those needs to be taken care in the post query.
If there are any special characters(like &,<,>,”,’) in the attribute values, then those need to be taken care of in the post query by escaping them.
If any table format is needed in the output document then we need to define the structure of the table in the template which we are uploading at the Datasource level and the data that needs to be populated in the table needs to be set at Post Query level .
In the above picture employees is a list which needs to be set in the post query of the datasource.
“Docx Bookmarks Util” Page can be used for testing the output of the document by selecting the Datasource and the template that needs to be tested.
Scenarios that are not covered in current release is:
In the Index, Page Numbers are not getting updated.
While installing the Microsoft word we need to remove “.Net Programmability support”, “Page Border Art” and “Quick Formatting Files” options otherwise it throws a corruption error while opening the downloaded file.