PHPWord icon indicating copy to clipboard operation
PHPWord copied to clipboard

Images not displayed on Open Office

Open agallou opened this issue 8 years ago • 0 comments

The issue

First, thank you for your work on PHPOffice, it's a great library that has allowed us to easily implement a Word export in our application.

In our export we add some images to the exported document. It worked great on multiple word processors but not on Open Office : the images were not displayed.

Here is a gist of a minimalist way to reproduce the problem : https://gist.github.com/agallou/7bb2373491f713bfc94fd622a02b9754 On this example we just add a section and an image in it.

Here is an .docx example generated by this gist : test.docx.zip (zipped, because github didn't allowed to upload this docx).

Some examples

Not working

The image is not displayed on Open Office 4.1.3, rev 1761381 (on Windows 10) :

win_10_openoffice

Working

The image is displayed on Libre Office 4.2.8.2, Build ID: 420m0 (on Ubuntu 14.4) :

ubuntu_14_4_libreoffice

The image is displayed on WPS Writer 10.1.0.5672 (on Ubuntu 14.4) :

ubuntu_14_4_xps_writer

The image is displayed on Libre Office 5.1.6.2 (on ubuntu 16.1) :

ubuntu_16_4_libreoffice_5 1

The image is displayed on Word 2016, version 1706, build 8229.2073 (on Windows 10) :

win_10_word

Our fix

Some of our users may open our documents with Open Office. So we had to make it work.

After creating a document with an image on WPS Writer and comparing this document.xml from a document generated by PHPOffice, we have changed the image class.

Those changes can be displayed here https://github.com/agallou/PHPWord/commit/0a8f3acc613b87ffe813f90cb0f149663a90a977

Besides the alignement, the styles does'nt work, and the image is still not displayed when it's included on the footer.

So it's not an ideal solution and could not be merged as-it but it allowed us to have something usable for our users.


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

agallou avatar Jul 17 '17 09:07 agallou