Forum


Replies: 3   Views: 3560
Html table with multiple rowspans per line not coming over correctly in pdf
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 wcalhoun  · 31-07-2015 - 15:40

I have an HTML table that has multiple rowspans in one row. The docx looks great, but when I convert it to PDF, only the last rowspan is coming over correctly. Here's an example table: <table border="1" style="border-collapse: collapse; width:100%"> <tbody> <tr> <td rowspan="2">1_1</td> <td>1_2</td> <td rowspan="2">1_3</td> <td>1_4</td> <td rowspan="2">1_5</td> </tr> <tr> <td>2_1</td> <td>2_2</td> </tr> </tbody> </table> In the PDF, only 1_5 is spanning two rows, 1_1 and 1_3 just have a blank cell below them.

Posted by admin  · 03-08-2015 - 08:41

Hello, The problem comes from the table auto width, that LibreOffice has some differences with Word. To use this auto value, its the default, you must set a value to w:w tag in the w:gridCol. To do this please edit the HTML2WordML, and change this line (around 1343): self::$WordML = str_replace('#<w:gridCol/>#', str_repeat('<w:gridCol/>', $column), self::$WordML); to: self::$WordML = str_replace('#<w:gridCol/>#', str_repeat('<w:gridCol w:w="1"/>', $column), self::$WordML); Regards.

Posted by wcalhoun  · 03-08-2015 - 15:26

That did it, thanks! Is this something that will be fixed in future versions, or is there a non-code workaround?

Posted by admin  · 04-08-2015 - 06:44

Hello, For now, it's a workaround but it'll be added in a next release using its own class. Regards.