My docx template I have { organization} (pay attention to leading whitespace) and {address} placeholders
My placeholder map have organization and address fields
Than program falls with error:
...: not all placeholders were replaced, want=2, have=1
I tried to run with debugger to see which behaviour going on under the hood. I found out that stripXmlTags method deletes whitespaces from placeholder. But inside of docx.Open() method you have another behaviour which does not trim whitespaces.
This results to placeholders dismatch and throwing an error.
Example:
docx
template I have{ organization}
(pay attention to leading whitespace) and{address}
placeholdersorganization
andaddress
fieldsThan program falls with error:
I tried to run with debugger to see which behaviour going on under the hood. I found out that
stripXmlTags
method deletes whitespaces from placeholder. But inside ofdocx.Open()
method you have another behaviour which does not trim whitespaces.This results to placeholders dismatch and throwing an error.