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

html to docx image not parsing #1288

Open
htmls opened this issue Feb 17, 2018 · 6 comments
Open

html to docx image not parsing #1288

htmls opened this issue Feb 17, 2018 · 6 comments

Comments

@htmls
Copy link

htmls commented Feb 17, 2018

Hello.

I'm using
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html, true, false);
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');

My $html contains several images like <img src="https://path_to_image">
$objWriter->save($file_name . '.docx'); returns a blank DOCX.

Without it works properly.
What's wrong?


### Context

* PHP version: 7.0.1
* PHPWord version: 0.13
@troosan
Copy link
Contributor

troosan commented Feb 17, 2018

There was indeed a problem with the parsing of images in version 0.13
This has normally been fixed in 0.14, can you try it out please?

@htmls
Copy link
Author

htmls commented Feb 18, 2018

How can I do it?
I've used {
"require": {
"phpoffice/phpword": "v0.14.*"
}
}
It installed 0.13.0

@troosan
Copy link
Contributor

troosan commented Feb 18, 2018

@htmls don't get fooled by the VERSION file, it did not get updated when 0.14 was released. You should have 0.14 installed. You can run composer show to list all your dependencies and their version.

@htmls
Copy link
Author

htmls commented Feb 18, 2018

sure.
pclzip/pclzip 2.8.2 A PHP library that offers compression an...
phpoffice/common 0.2.7 PHPOffice Common
phpoffice/phpword v0.14.0 PHPWord - A pure PHP library for reading...
zendframework/zend-escaper 2.5.1
zendframework/zend-stdlib 2.5.1

But I'm still getting a blank docx when using html with <img >

@troosan
Copy link
Contributor

troosan commented Feb 18, 2018

Can you post the html you are parsing?

@htmls
Copy link
Author

htmls commented Feb 19, 2018

Here is it

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<p><img src="https://bitrixportal.ru/upload/htmls.docdesigner/34f/logo.jpg"></p>
</body>
</html>

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

2 participants