This project is read-only.

How can I open an existing word doc?

Oct 3, 2014 at 12:50 PM
Edited Oct 3, 2014 at 3:07 PM
I'd like to know how to open an existing word document and edit it...

Someone can help me?
Oct 8, 2014 at 4:07 PM

you can use template Class

as this example

$PHPWord = new \PhpOffice\PhpWord\PhpWord();
$document = $PHPWord->loadTemplate("example.docx");

after open you can change values inside doc (but every item to change in the original docs must to be ${ITEM_TO_CHANGE}) with this command:

$document->setValue("ITEM_TO_CHANGE","New value");

to Save new File :


i hope was helpful