Skip to content
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

I can write a phpWord object to output but not a template #813

Open
ShawnFuller opened this issue Jun 11, 2016 · 0 comments
Open

I can write a phpWord object to output but not a template #813

ShawnFuller opened this issue Jun 11, 2016 · 0 comments

Comments

@ShawnFuller
Copy link

ShawnFuller commented Jun 11, 2016

I can create a TemplateProcessor and save a file to my public directory, but I cannot write it to output.

$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($directory_filename);
$datetime = date('Y_M_d_G_i');
$filename = 'receipt_' . $datetime . '.docx';
// Here I fail because I cannot create a $phpWord from a $templateProcessor
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$xmlWriter->save("php:https://output");

Yes, I do $templateProcessor->saveAs($directory_filename) and I get copy of my template with any changes saved to my public directory. But even then .. this does not work:

$phpWord = \PhpOffice\PhpWord\IOFactory::load($directory_filename, 'Word2007'));

If I write this to output:

// header settings omitted
$xmlWriter->save("php:https://output");

I get a PhpWord base document but not the one on the server. Plus I would rather not have one on the server that I have to delete, subsequently.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant