Replies: 5   Views: 3208
Colspan / rowspan and openoffice / libreoffice?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by jorismak  · 03-08-2017 - 14:12

Hi there,

Sorry if this has been asked before, but I can't seem to get 'colspan' and 'rowspan' working with addTable() in LibreOffice (and because of it, it doens't work in the PDF output)

The same .docx seems to open fine in MS-Word. Is there a trick to get it working in OpenOffice?

Posted by admin  · 03-08-2017 - 14:42


Please check the included sample Core/addTable/sample_3.php, it includes rowspan and colspan values and MS Word, LibreOffice and OpenOffice open it fine.

Maybe you are using an old version of LibreOffice? Please update to the latest version of LibreOffice (5.4 is the newest). If you are using OpenOffice you may need using OdfConverter, the support of DOCX for OpenOffice is not as good as LibreOffice.


Posted by jorismak  · 03-08-2017 - 14:53

We now discovered that Libreoffice opens it fine _if_ the last row does NOT contain any colspans.

This is also true for the examples on the addTable() API page. They work fine on Libreoffice (Which caused us to try some more and investigate). Everything seems to work fine _until_ you put a row which uses _a_ colspan somewhere as the last row in the table


Posted by jorismak  · 04-08-2017 - 09:06

Will try with removing the element.

For now I made a little helper utility that counts the number of columns and rows, and adds an extra row with empty columns, and sets the row properties of that row to a height of 1 without border. So basically invisible row. Seems to work fine for now. 

Can you give a quick example of how the xpath query would look, or how you would remove removeWordContent for something like this? Didn't use it before



Posted by admin  · 04-08-2017 - 10:07


Please check the included sample DocxPath/removeWordContent/sample_9.php . It removes the second row but you just need to replace the position by last value to remove the last row.

DOCXPath can word with templates and DOCX created from scratch.