Hello,
The current version of phpdocx sets default values to cell margins (using a custom table style or not), so you need to overwrite them with padding properties if you want to set custom values.
The testing branch adds the following change (not available in the stable branch):
if (!$this->strictWordStyles) {
if (isset($properties['padding_left']) || isset($properties['padding_right'])) {
$stringTblPr .='<w:tblCellMar>';
if (isset($properties['padding_left'])) {
$paddingLeftValue = $this->_wordMLUnits($properties['padding_left']);
$stringTblPr .= '<w:left w:type="dxa" w:w="'.$paddingLeftValue[0].'"/>';
}
if (isset($properties['padding_right'])) {
$paddingRightValue = $this->_wordMLUnits($properties['padding_right']);
$stringTblPr .= '<w:right w:type="dxa" w:w="'.$paddingRightValue[0].'"/>';
}
$stringTblPr .='</w:tblCellMar>';
}
}
So no padding value is added to w:tblCellMar if strictWordStyles is set to true. This change will be added to the next stable version of phpdocx (there's no release date); you can apply the same change to phpdocx 10 in generateTblPr.
Other approach, that doesn't require changing the library, is using DOCXPath (https://www.phpdocx.com/api-documentation/docx-path/remove-elements-in-docx) to remove that cell margins, but we think the first solution is the easiest one.
Regards.