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.
In my doc, I have table in a table.
Everything seems fine when I open the document in Word or open Office.
After Converting the doc to a pdf with the conversion plugin, the nested table looks very strange. The with seems to be 0 or something. I can only see the borders.
Thanks for your help.
Hello,
What conversion plugin are you using? Based on OpenOffice or LibreOffice?
Note that as explained on:
http://www.phpdocx.com/documentation/conversion-plugin/preparing-the-templates-for-its-conversion
You need to set the width for each table column.
Regards.
I am using the OpenOffice Conversion....
Ok, that was it. Important detail:
When setting width, columnWidths, or tableWidth, alwaysset values as Integer, never floating points. This works in OpenOffice but not when converting. Use intval() to make sure its a Integer.
For Example:
'tableWidth' => array('type' => 'dxa', 'value' => intval(2 * $columnWidth - 1000)),
Hello,
I have a similar issue in nested tables when converting my document to ".pdf" or ".odt" (it works well in ".docx").
Widths values of the table colums are reset to equals values (the entire row width divided by the number of columns in this row). When there's two columns, each colums takes 50% of the entire width. When there's three columns, each colums takes 33% of the entire width, etc.
I'm using Corporate version of Phpdocx 4.5 and LibreOffice plugin (4.3.7.2 version) for conversion. Each width are previously set for each column in the HTML code, so I don't undestand where this problem could come from.
Widths are configured in percentage but when I convert them in pixels it doesn't change anything.
Are you aware of this issue? Do you reproduce it ?
Thank you.
Here is an example of my HTML code:
[body style="padding: 15mm; width: 180mm;"]
[table cellspacing="0" border="1" style="border-color: #000000; border-width: 1px; ; width: 100%;"]
[tbody]
[tr]
[td]
[table cellspacing="0" border="0" style="width: 100%;"]
[tbody]
[tr]
[td style="width: 70%; padding: 5px;"][strong][span style="font-size: 13px;"]HEADER 1[/span][/strong][/td]
[td style="width: 30%; padding: 5px;"][strong][span style="font-size: 13px;"]HEADER 2[/span][/strong][/td]
[/tr]
[/tbody]
[/table]
[/td]
[/tr]
[tr]
[td style="padding-top: 10px; padding-bottom: 10px;"]
[table cellspacing="0" border="0" style="width: 100%;"]
[tbody]
[tr]
[td align="right" style="padding-right: 5px; padding-left: 5px; width: 25%;"][strong][span style="font-size: 13px;"]ROW 1 - COLUMN A[/span][/strong][/td]
[td style="padding-left: 5px; padding-right: 5px; width: 45%;"][span style="font-size: 13px;"]ROW 1 - COLUMN B[/span][/td]
[td rowspan="7" style="width: 30%; padding: 5px;"][p][span style="font-size: 16px;"][strong]COLUMN C[/strong][/span][/p][/td]
[/tr]
[tr]
[td align="right" style="padding-right: 5px; padding-left: 5px; width: 25%;"][strong][span style="font-size: 13px;"]ROW 2 - COLUMN A[/span][/strong][/td]
[td align="left" style="padding-left: 5px; padding-right: 5px; width: 45%;"][span style="font-size: 13px;"]ROW 2 - COLUMN B[/span][/td]
[/tr]
[tr]
[td align="right" style="padding-right: 5px; padding-left: 5px; width: 25%;"][strong][span style="font-size: 13px;"]ROW 3 - COLUMN A[/span][/strong][/td]
[td align="left" style="padding-left: 5px; padding-right: 5px; width: 45%;"][strong][span style="font-size: 13px;"]ROW 3 - COLUMN B[/span][/strong][/td]
[/tr]
[tr]
[td align="right" style="padding-right: 5px; padding-left: 5px; width: 25%;"][strong][span style="font-size: 13px;"]ROW 4 - COLUMN A[/span][/strong][/td]
[td align="left" style="padding-left: 5px; padding-right: 5px; width: 45%;"][p][span style="font-size: 13px;"]ROW 4 - COLUMN B[/span][/p][/td]
[/tr]
[tr]
[td align="right" style="padding-right: 5px; padding-left: 5px; width: 25%;"][strong][span style="font-size: 13px;"]ROW 5 - COLUMN A[/span][/strong][/td]
[td align="left" style="padding-left: 5px; padding-right: 5px; width: 45%;"]ROW 5 - COLUMN B[/td]
[/tr]
[tr]
[td align="right" style="padding-right: 5px; padding-left: 5px; width: 25%;"][strong][span style="font-size: 13px;"]ROW 6 - COLUMN A[/span][/strong][/td]
[td align="left" style="padding-left: 5px; padding-right: 5px; width: 45%;"][span style="font-size: 13px;"]ROW 6 - COLUMN B[/span][/td]
[/tr]
[tr]
[td align="right" style="padding-right: 5px; padding-left: 5px; width: 25%;"][strong][span style="font-size: 13px;"]ROW 7 - COLUMN A[/span][/strong][/td]
[td align="left" style="padding-left: 5px; padding-right: 5px; width: 45%;"][span style="font-size: 13px;"]ROW 7 - COLUMN B[/span][/td]
[/tr]
[/tbody]
[/table]
[/td]
[/tr]
[/tbody]
[/table]
[/body]
Edit: I cannot make the HTML code to be quoted/uninterpreted in your forum ("" doesn't work), please replace "[" character by "<" and "]" character by ">", thank you. Hello,
Please check that Tidy is enabled and running on your server and try again. You need to set the width using px.
If you still have issues after this test please send the HTML to contact[at]phpdocx.com
Regards.
Thank you for your response.
Tidy is enabled and running on my server.
After a few more tests, I've corrected the problem of proportions in this table (by setting the "table" element's width in pixel and letting "td" element's width in percentage).
However, another similar issue remains in another table...
I'll send you an email with more details.
Have a good day.