Phpword: Inventory system doesn't create the word document

Created on 4 Jun 2018  路  4Comments  路  Source: PHPOffice/PHPWord

I`m trying to make this system to make a word archive and save it.. but at first it said that string was a special character.. so i just change it from:

"use PhpOffice\PhpWord\Shared\String;"
to "use PhpOffice\PhpWord\Shared\String as POString;"

and i changed it too when the string was.. so i press to get the word file but it doesn't work.. just throw me this:

Fatal error: Uncaught Error: Class 'PhpOffice\PhpWord\Shared\String' not found in C:\xampp\htdocs\texmom\PhpWord\Element\Text.php:139 Stack trace: #0 C:\xampp\htdocs\texmom\PhpWord\Element\Text.php(59): PhpOffice\PhpWord\Element\Text->setText('PROVEEDORES') #1 [internal function]: PhpOffice\PhpWord\Element\Text->__construct('PROVEEDORES', Array) #2 C:\xampp\htdocs\texmom\PhpWord\Element\AbstractContainer.php(145): ReflectionClass->newInstanceArgs(Array) #3 [internal function]: PhpOffice\PhpWord\Element\AbstractContainer->addElement('Text', 'PROVEEDORES', Array) #4 C:\xampp\htdocs\texmom\PhpWord\Element\AbstractContainer.php(112): call_user_func_array(Array, Array) #5 C:\xampp\htdocs\texmom\report\providers-word.php(16): PhpOffice\PhpWord\Element\AbstractContainer->__call('addtext', Array) #6 {main} thrown in C:\xampp\htdocs\texmom\PhpWord\Element\Text.php on line 139

(proveedores means providers in spanish) just a name.

any clue?

Most helpful comment

you must be using an old version of PHPWord. This class was renamed some time ago.
Please use version 0.14

All 4 comments

you must be using an old version of PHPWord. This class was renamed some time ago.
Please use version 0.14

thank you a lot! now i have to change almost everything but for sure it's going to work! 馃槃

@troosan I have a question, it's possible to change my old phpword folder with the new (yeah it is but..) without touching my code in that folder? cuz' it would be a problem doing all of it again.. hope you asnwer me soon. meanwhile I'll change it one by one not touching my code (i have a long time without programming so I'm learning again) hehehe. Thank you!

@carlosvr90 I don't know which version you were using before and how you were loading the dependencies, but the standard way to do so now is through Composer. I hope you won't have to rewrite your whole application!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dwalker109 picture dwalker109  路  6Comments

Ryuzakix3 picture Ryuzakix3  路  6Comments

cedrictailly picture cedrictailly  路  5Comments

cyrillkalita picture cyrillkalita  路  6Comments

phuwin picture phuwin  路  3Comments