iulica / docx-mailmerge

Mail merge for Office Open XML (docx) files without the need for Microsoft Office Word.
MIT License
55 stars 7 forks source link

Barcode: CODE128 not working with whitespaces in string #23

Open polynaught opened 3 days ago

polynaught commented 3 days ago

When using docx-mailmerge2 with a word template that has barcodes strings containing whitespaces are being ignored and cause an error inside the replaced mergefield: Required parameters are missing or incorrect.

Expected Behavior

Whitespaces or other such characters should be accepted as valid string input for calls to { DISPLAYBARCODE { MERGEFIELD param } CODE128 }.

Current Behavior

As described above, place a barcode inside the docx template and pass it a string containing a whitespace. The barcode will break - however, regular mergefields will accept strings with whitespaces just fine.

Context

I want to create labels automatically based on csv files that get parsed by python and passed to word docx files through the use of your library docx-mailmerge2.

Your Environment

Windows

iulica commented 3 days ago

{ DISPLAYBARCODE "{ MERGEFIELD param }" CODE128 }

Any string value that may have spaces should be enclosed in double quotes. Try it like this, it should work.