Hi,
I was wondering if there is a way to remove the 0.12" left indent on tables? Currently when i add a table with 0 margin/border/padding it still leaves an indent from the left on it in word. This is adding a table via html.
Hi,
I was wondering if there is a way to remove the 0.12" left indent on tables? Currently when i add a table with 0 margin/border/padding it still leaves an indent from the left on it in word. This is adding a table via html.
Hello,
Please post the most simple script that illustrates your issue and if Tidy is enabled and running. Also, please run the included example Core/embedHTML/sample_1.php that adds a tablet without indentations.
The style margin-left allows to set 0 as table indentation, but this always if the option strictWordStyles isn't true.
Regards.
Hi, I can confirm that i have tried everything said below
I have made an image describing the issue and have shown the code (margin and padding left)
Also strictWordStyle is set to false otherwise it doesn't display correctly.
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.