extensions word documents

Hi, :unsure: I need extensions for Msword files.

I have in my site:

1.the people upload msword files and I need modify this file, (add one code in the head of the Msword file ).

I prove code for read Msword but dont work…

please if you know how add text in Msword and conserved the format of document

tell me