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

Corrupt Word file, even when no content set #478

Open
abombelli opened this issue Feb 5, 2015 · 2 comments
Open

Corrupt Word file, even when no content set #478

abombelli opened this issue Feb 5, 2015 · 2 comments

Comments

@abombelli
Copy link

abombelli commented Feb 5, 2015

I create a word file for automatic download, but even with no content set, I cannot open the file in Word as I get the following error: "The open XML file ........docx cannot be opened because there are problems with the contents or the file name might contain invalid characters (for example , \ /)"

This is my code, as you can see there is no text with any invalid characters.

// Init PHPWord
require_once ABSPATH . 'wp-content/themes/ine-intranet/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$file = 'INE_Report.docx';
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename="' . $file . '"');
header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$xmlWriter->save("php:https://output");

Any idea?


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

@luoboding
Copy link

any update?

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@github-actions github-actions bot added the Stale label Nov 18, 2022
@Progi1984 Progi1984 removed the Stale label Nov 18, 2022
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

3 participants