The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Loading A .docx with PHPWord Reply To: Loading A .docx with PHPWord

Harris Christiansen

The library for phpWord can be found here:

An example for using phpWord Templates can be found here:

To me it was obvious that it was not loading the template file because, following phpWords examples, if I add sections and text to the file, that section/text shows up in the output file. But nothing from the loaded template file shows up in the output file.

Error reporting is enabled to show all errors and warnings, but nothing is shown. While it is a bit annoying of syntax to me as well, you are actually suppose to save the $phpWord variable and not the created $document. Sections are added to the file in the same way, and saving them by referring to $phpWord does indeed work.

I have tended to stay away from the website you linked because it appears that the project has drifted from that website, as the version hosted there is very old compare to the current official version on github.