Not got a lot of experience with phpWord and coming across the following error:
Fatal error: Uncaught exception 'BadMethodCallException' with message 'Cannot add PreserveText in Section.'
Its happening when using the below line:
$phpWord = \PhpOffice\PhpWord\IOFactory::load($document_location . $document_name . '.docx');
The document definitely exists and I can save the document and readfile as well.
Any insight would be greatly appreciated.
I had the same Problem (also asked here) and for me loading the document worked after I removed all mail merge fields from it. Maybe this works for you, too
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