I have an entityform where users fill in a certain number of fields. On the other side I have an MS word file with macros that I use as a template. The word file has a preestablished text, common to all drupal website users.

So far, using views data export I can download each user's entityform fields data and manually generate a new word file updating those fields (inside the word file) that are unique to each user, conserving the preestablished text, common to all of them.

At the moment this solution seems to work nice but I know that is not a proper way of doing it, specially as soon as the number of users start to grow, I won't be able to generate a new word file for each new user with the updated fields data.

I'm seeking the way of generating a new word file with the entityform user fields data updated every time a user submits the entityform.

So my question is, whats the best approach to attack this issue? I was thinking that maybe I could inser code in the entityform using PHPword library, in order to generate the word file but a lot of questions come to head.

How can I get the data fields from the entityform as variables if I insert code in the entityform?

Any help is welcome, THX