Replies: 1   Views: 2850
Text align to table within table or how to keep a table from dropping individual rows onto next page
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  · 19-01-2018 - 07:28

So I have <HTML> form I  am converting to docx with a table that has some cells aligned right <td style="text-align:right;">.

I didn't want the table to drop individual rows to another page as other parts of the form grew, so I added the table within an table and gave the parent table value: "page-break-inside: avoid;".
Now however the text-alignments are no longer working. I have tried style="float: right; text-align: right;" and the <td> value of align="right". None of them works now that the table is within another table.

Is there a way to either have one table that doesn't drop individual rows onto next page, but the whole content within the table?
Is there a way to force the <td style="text-align:right"> to cells within table inside another table?

Posted by admin  · 19-01-2018 - 08:02



Prevent break tables using addTable

Prevent break tables using HTML


MS Word doesn't include an option to keep tables on single pages ( You can get a similar behavior using keep lines (page-break-after: avoid;) and keep next (page-break-inline: avoid;) styles, but they are only available for paragraphs. So you should add paragraphs for each cell and then apply these keep styles.

DOCXPath and DOCXCustomizer can be helpful to modify tables an apply that kind of styles after the HTML to DOCX conversion has been completed, but they are only available in Advanced (DOCXPath) and Premium (DOCPath and DOCXCustomizer) licenses.

About your question, sorry but there's no way to force a text-align to ceels within table inside another table.