Hello,
It's no a phpdocx problem but from some PHP Tidy versions that wrap contents (that ommits the wrap option sets as 0 to avoid wrapping), if we run your code on our test servers we get the correct output without the extra blank spaces. You can change Tidy settings in the INI settings file (https://www.php.net/manual/en/book.tidy.php), or use the removeLineBreaks option with HTML methods or edit DOMPDF_lib.php file and replace the following line:
'wrap' => 0,
by a very high value, for example:
'wrap' => 99999999999999,
The next release of phpdocx will include the previous change to avoid that issue from PHP Tidy.
Regards.