How php work with docx file. hi, I wont to open docx file replace some variable.
in *.docx file have Name : {variable1} Address : {variable2}
use php 5.1 version
How php work with docx file. hi, I wont to open docx file replace some variable.
in *.docx file have Name : {variable1} Address : {variable2}
use php 5.1 version
You can checkout some PHP libraries below:
PHPDocX: http://www.phpdocx.com/
OpenTBS: http://www.tinybutstrong.com/opentbs.php
.docx
files are just zip
files containing other files. You can try to unzip one using your favourite uzipping tool and explore it to locate the things you need to replace. Then you can proceed with PHP: http://www.php.net/manual/en/class.ziparchive.php
you can use this simple library to do so: Github
Code example:
Text to text replace This code will replace $search to $replace in $pathToDocx file
$docx = new IRebega\DocxReplacer($pathToDocx);
$docx->replaceText($search, $replace);