lukasjarosch / go-docx

Replace placeholders inside docx documents with speed and confidence.
MIT License
204 stars 47 forks source link

Error if placeholder has leading or tailing whitespace(-s) inside of delimiters #21

Closed tymbaca closed 3 months ago

tymbaca commented 1 year ago

Example:

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.