Hello,
We have run the following code and it works correctly:
$html = '<span>Content</span> <b><phpdocx_link data-text="My Link" data-url="https://www.phpdocx.com" /></b>';
$docx->embedHTML($html, array('useHTMLExtended' => true));
$html = '<span>Content</span> <phpdocx_link data-text="My Link" data-url="https://www.phpdocx.com" />';
$docx->embedHTML($html, array('useHTMLExtended' => true));
We think the problem doesn't come from the phpdocx_link tag but the default behaviour of tables in MS Word, if a content exceeds the cell margin as seems the case (adding a link or not and the blank spaces added to the contents may vary the content size), an automatic line break is done.
We recommend you to test the previous script and your code out of table contents to check if this is the case. And also test using an a tag instead of phpdocx_link to check if you get the same output.
If you send to contact[at]phpdocx.com your DOCX we'll check it to know the exact source of that behaviour.
Regards.