I'm using docxtemplater to create a word document based on JSON values (using surveyJS). In case some questions are not answered, the variable shows "undefined" in the final document.
How can I make sure that any "undefined" output is highlighted? I found some answers on how to use nullGetter to replace "undefined" with a custom string but nothing on text background.
The JSON looks something like this:
{
"nameIndividual": "John Smith",
"mgmt": "Management Name",
"mgmtName": "Tim Test",
"address": "854 Test Avenue, Example City",
"email": "test@management.com",
"socialMediaOptions": [
"Twitter",
"YouTube",
"Instagram",
"Facebook"
]
}
Is there a way to do this in the word template itself without having to write {#nameIndividual == undefined}Undefined{/} for every single variable...
If not, how can this be done with Javascript?
Any help is highly appreciated!
Thanks!