Extract the XML, replace, reinsert. http://stackoverflow.com/questions/124959/create-word-document-using-php-in-linux/4138895#4138895 Requires a template syntax like '{%s}'. https://github.com/tyz910/docx-templates