-
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
HTML writer error #285
Comments
Hi @gaf09, Could you give us a sample code ? |
Yes, I put the code here: $PHPWord = new \PhpOffice\PhpWord\PhpWord();
// Load template
$template = $PHPWord->loadTemplate($WordFile);
// File name & directory
$tempFile = '../temp/' . time();
// Save template has new Word file
$template->saveAs($tempFile . ".docx");
// Load generated Word
$PHPWordLoad = \PhpOffice\PhpWord\IOFactory::load($tempFile . ".docx");
// Save generated word in HTML
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($PHPWordLoad, 'HTML');
$objWriter->save($tempFile . ".html"); I have also tried exporting to PDF but the same error with images. (because to save to PDF the system using HTML anyway). PD: The template includes images |
Could you give us your $WordFile for testing ? |
Yes of course, here's my docx: Here I also added the HTML generated by the sample code
|
Hi @Progi1984 could have any idea why this error is happening ? Thanks!! |
No for the moment, but we have all informations. |
Hello, has anyone been able to resolve this? If yes, could you kindly provide details on how to go about it. Thank you. |
Hello, I found out that DrawingML Objects (w:drawing) are not being parsed by the Word2007 Reader and also not supported by the HTML writer. Had to modify PHPWord to extract these and convert any WMF files into PNGs using Imagick since Browsers don't support WMFs. |
The reader only interprets w:pict images, not w:drawing images in the MSWord XML. Hope this can serve as a workaround. |
Some helps for which one who want to create a PR :
|
Hi,
Several hours ago I'm trying to find out why not working the HTML Writer, more specifically with the element Image of HTML Writer.
The error happens when i save a Word file that generates the HTML file, works with all elements excellently, but not work with the images. That is, it generates all the code less the "img" tag.
I hope they know what's going,
Thanks and sorry for the bad English :)
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: