After some googling i found the Github project docxtemplater. Having a look at the examples i found out that such a task is also able directly on the client/browser side.
Curious about that i thought i should give it a try inside UI5.
|Demo UI for docxtemplater example|
Now let us go into detail.
To be able to use docxtemplater you have to build your own version of the needed library as decribed in the corresponding build manual. Be sure to use the 1.x branch from github, because the API has dramatically changed and the following example depends on 1.x.
sap.ui.core.util.File.savelibrary introduced with version 1.22.
We use this internally while marketing is publishing the companies corporate word templates and you can easily inject global text replacements. This forces everyone to use the lastest corporate templates by easily automate redundant tasks. Think about an UI5 app with selectable text fragments to automatically generate target word file ;-)