-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Template not working #397
Comments
I've found the problem! I have made the template with OpenOffice and then it isn't a Microsoft Word document. Thnx Google! |
I am facing same problem. I tried your solution but still no luck. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Hi,
I'm new to PHPWord and I'm trying to allow in my website the download of a document .docx.
I've started doing a simple test with the code below:
require_once 'PHPWord.php';
$PHPWord = new PHPWord();
$template = $PHPWord->loadTemplate('Template.docx');
$template->setValue('Name', 'Somebody someone');
$template->setValue('Street', 'Coming-Undone-Street 32');
$template->save('helloWorld.docx');
This gives me a corrupt file helloWorld.docx that I can't open.
I've tried to add the lines:
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('helloWorld.docx');
And in this way the script outputs me 2 file: one helloWorld.docx empty and another equal to the template.
What could be the problem?
Thanks.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: