i'm trying to create a table with embedHtml() but it has always cellborder and cellspacing even if i state "<style>table, th, td { border: 0; }</style> " and "<tablecellspacing="0"cellpadding="0">".
any tips?
i'm trying to create a table with embedHtml() but it has always cellborder and cellspacing even if i state "<style>table, th, td { border: 0; }</style> " and "<tablecellspacing="0"cellpadding="0">".
any tips?
Hello,
You can use HTML attributes, CSS styles or a MS Word custom table style.
For example, the following script removes the border and set a border-collapse:
<?php
require_once 'classes/CreateDocx.php';
$docx = new CreateDocx();
$html = '
<style>
table, th, td { border: 0; }
table {border-collapse: collapse;}
</style>
<table>
<tbody>
<tr width="600">
<td style="background-color: yellow">1_1</td>
<td rowspan="3" colspan="2">1_2</td>
</tr>
<tr width="600">
<td>Some random text.</td>
</tr>
<tr width="600">
<td>
<ul>
<li>One</li>
<li>Two <b>and a half</b></li>
</ul>
</td>
</tr>
<tr width="600">
<td>3_2</td>
<td>3_3</td>
<td>3_3</td>
</tr>
</tbody>
</table>';
$docx->embedHTML($html);
$docx->createDocx('output');
If you open the DOCX output with MS Word 2003 or newer or LibreOffice 5 or newer, you can check there's no border and the table is 'collapse'.
A very similar sample is included in the package (examples/Core/embedHTML folder).
Regards.
it appears it's not working. i menage to partially hide it using { border: 0 solid white; } but the border is still there
Hello,
We have run the previous script and then opened the DOCX output with MS Word 2007, MS Word 2010, MS Word 2013, MS Word 2016 and LibreOffice 6 and there's no border displayed.
What program and version are you using to open the DOCX?
Regards.