I have to modify the uploaded .doc or .docx file in php. I googled but i only found how to read that. I want the word file as it is and put text at the bottom of that MS Word file at run time. How is this possible anyone know please reply or give me example script.
Thanks,
You can use the PHPWord_Template Class to open an existing DOCX File and then replace some text marks with your individual text. Alternatively you can open the DOCX file with the ZipArchive extension and then read/write every xml File (document.
$filename = 'ahfdghasfdh. doc'; header('Content-type: application/msword'); header('Content-Disposition: inline; filename="testqq"'); @readfile($filename);
We can edit DOCX file with an office application. As DOCX is very popular format there are a lot of office applications for different platforms like Windows, MacOSX, Linux etc.
I'm the developer of PHPWord. You can use the PHPWord_Template Class to open an existing DOCX File and then replace some text marks with your individual text.
Alternatively you can open the DOCX file with the ZipArchive extension and then read/write every xml File (document.xml, header.xml, footer.xml, ...) you want. This method is nothing else than the PHPWord_Template class. ;)
You can use PHPWord.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With