Forums

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

#176700
__
Participant

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.

…Which I noticed after following your link. The github repo seems to have an Issues page, though. You might start by looking through those reports to see if you can find a similar issue. (Note that these are bug reports, however; it is not an appropriate place to ask for help with a specific bit of code.*)

* although people seem to ask a lot of questions there, so maybe the authors don’t mind…

Error reporting is enabled to show all errors and warnings, but nothing is shown.

Okay.

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.

It has more to do with how the code actually works. The PhpWord instance represents the entire document, while documents, sections, etc. represent parts of the document (actually “nested” inside the PhpWord object). Knowing this, it makes sense that you would save the PhpWord object rather than one of the components.

I’ll take some time to look over how this works, but I might not have time right away to actually download and test anything out. I’ll let you know if I find any clues.