I've had to automate the compilation of letters or labels, so I thought I'd share what I have achieved.
I hope it will be useful to someone or just as an idea

Attached, you can find the sources. Note: you probably need to change the name of the file .rc in according to your compile command.
At startup, the program will create a table and a text file for sample. The data used were invented purely for demonstration purposes

Through menu items, you can try some features

Best regards