Hello,
Thanks for the info. Then you need to remove the cell margin, not the table margin.
To do this you have three approaches:
1. Wrap the cell content in a paragrah and set a margin left negative value:
$html .= '<table border="1" style="border-collapse: collapse; border-left-width: 0px;" width="600">
<tbody>
<tr width="600">
<td style="background-color: yellow;"><p style="margin-left:-7px;">1_1</p></td>
<td rowspan="3" colspan="2">1_2</td>
</tr>
2. Create a table style (with Word or phpdocx that sets this left margin as 0). This style can be used with embedHtml.
3. Apply a small patch in the file classes/HTML2WordML.inc (this patch was included in phpdocx 9.5). Around line 1809 (after //w:tblCellMar comment) please add these lines:
if (isset($properties['padding_left']) || isset($properties['padding_right'])) {
$stringTblPr .='<w:tblCellMar>';
if (isset($properties['padding_left'])) {
$stringTblPr .= '<w:left w:type="dxa" w:w="'.$this->_wordMLUnits($properties['padding_left'])[0].'"/>';
}
if (isset($properties['padding_right'])) {
$stringTblPr .= '<w:right w:type="dxa" w:w="'.$this->_wordMLUnits($properties['padding_right'])[0].'"/>';
}
$stringTblPr .='</w:tblCellMar>';
}
And now you can set a custom default padding:
$html .= '<table border="1" style="border-collapse: collapse;padding-left: 0px;" width="600">
<tbody>
<tr width="600">
<td style="background-color: yellow">1_1</td>
<td rowspan="3" colspan="2">1_2</td>
</tr>
Regards.