Hi obarz, i just greet you with us. Why don't you post the same message in the Calibre forum. Let me find it for you.
Here.
I had second thoughts. I think Word is not exactly the best tool for your purposes (I know next to nothing about Calibre, except that it does what I need).
Word adds an incredible amount of useless gibberish to text files. There is a full literature on the subjects and a body of myths about it.
Scripting for Words used a delirium tremens scripting language that goes under the name of Visual Basic, that is probably the Microsoft downgraded version of C#- VB is the last structured and less intuitive scripting language that I know of. Maybe it is still the scripting language for Word, even now.
I would think of alternative to Word.