Hello,
The enableCompatibilityMode method has been removed in phpdocx 9, as it's not used anymore. You can read this on the release notes: https://www.phpdocx.com/news/post/phpdocx-v9-release-notes/218
About your width question, some minutes ago we have uploaded a minor change to all packages of phpdocx 9 to prevent width issues when working with some versions of LibreOffice, maybe you are opening the DOCX with LibreOffice? Please download the package again from MY PHPDOCX, or if you want to do the same change to your current installation of phpdocx 9, please edit HTMLWordML.php and around line 1560 change these lines:
case 'tr':
//Before closing a row we should make sure that there are no lacking cells due to a previous rowspan
$row = count(self::$tableGrid[self::$openTable]) - 1;
$column = count(self::$tableGrid[self::$openTable][$row]);
$sRet .= $this->closeTr($row, $column);
if (strpos($this->wordML, '#<w:gridCol/>#') !== false) {
// get the cell width
if (self::$tableGrid[self::$openTable][$row][$column][2]['width'] !== null) {
list($cellWidth, $cellWidthType) = $this->_wordMLUnits(self::$tableGrid[self::$openTable][$row][$column][2]['width']);
}
if ($cellWidth) {
$i = 0;
foreach (self::$tableGrid[self::$openTable][$row] as $rowProperties) {
list($cellWidth, $cellWidthType) = $this->_wordMLUnits($rowProperties[2]['width']);
if (!isset($this->gridColValues[$i]) || $this->gridColValues[$i] > $cellWidth) {
$this->gridColValues[$i] = $cellWidth;
}
$i++;
}
}
}
//We now may close the tr tag
$sRet .= '</w:tr>';
break;
with:
case 'tr':
//Before closing a row we should make sure that there are no lacking cells due to a previous rowspan
$row = count(self::$tableGrid[self::$openTable]) - 1;
$column = count(self::$tableGrid[self::$openTable][$row]);
$sRet .= $this->closeTr($row, $column);
if (strpos($this->wordML, '#<w:gridCol/>#') !== false) {
// get the cell width
if (self::$tableGrid[self::$openTable][$row][$column][2]['width'] !== null) {
list($cellWidth, $cellWidthType) = $this->_wordMLUnits(self::$tableGrid[self::$openTable][$row][$column][2]['width']);
} else if (self::$tableGrid[self::$openTable][$row][$row][2]['width'] !== null) {
list($cellWidth, $cellWidthType) = $this->_wordMLUnits(self::$tableGrid[self::$openTable][$row][$row][2]['width']);
}
if ($cellWidth) {
$i = 0;
foreach (self::$tableGrid[self::$openTable][$row] as $rowProperties) {
list($cellWidth, $cellWidthType) = $this->_wordMLUnits($rowProperties[2]['width']);
if (!isset($this->gridColValues[$i]) || $this->gridColValues[$i] > $cellWidth) {
$this->gridColValues[$i] = $cellWidth;
}
$i++;
}
}
}
//We now may close the tr tag
$sRet .= '</w:tr>';
break;
The changed is that these three lines have been added:
else if (self::$tableGrid[self::$openTable][$row][$row][2]['width'] !== null) {
list($cellWidth, $cellWidthType) = $this->_wordMLUnits(self::$tableGrid[self::$openTable][$row][$row][2]['width']);
}
And try again. After this minor chage the problem with some versions of LibreOffice is fixed.
Regards.