Forum


Replies: 3   Views: 3743
How center html table?
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 arivanbastos  · 19-12-2016 - 15:03

I have an DOCX template with one variable that I replace by an HTML table. The variable is centered at the DOCX document:

------------------------------------------
|            {MY_TABLE}           |
|                                           |
------------------------------------------

After I run $docx->replaceVariableByHTML('HTML', 'block', $myTable) and generate the DOCX document the table is not center aligned. I also tried with no luck:

  1. Add "align=center" to table.
  2. Wrap the table with "<center>" tag.
  3. Wrap the table with "<div style="width:100%; text-align: center;>"

 

So, what am I doing wrong? How can I achieve HTML table centering?
Thank u!