Forum


Replies: 3   Views: 1312
Phpdocx_link is adding/removing breaks
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 12-04-2021 - 14:14

Hello,

Thanks for posting the code that illustrates your issue.

The problem is how the WordFragments work internally, that in certain cases don't add a run-of-text to apply that break. Instead of adding new tags to wrap the contents to use phpdocx_link with line breaks, for your case the best and easiest approach is using a tags (that allows using internal anchors too) wrapping the contents in a paragraph:

<td width="252pt" valign="top">
<p>
<b><a href="#7d6a55a24099ef9068ad4bbbc35aa0d1">Maurice Nicolas</a></b> - BioNTech AG<br />
Business Development<br />
P: +1169005827387<br />
C: +1 231-607-8121<br />
demo_qmbc9b@troutaccess.com <br/>
<b><a href="#1c6bd954cd94500481cd13cb21fda279">Hans Hansen</a></b> - ABC Capital<br />
PNC Relationship Manager<br />
hans.hansen@gmail.com </p></td>

As you need to apply the anchors to link internal contents instead of external ones, you can set parseAnchors as true when importing HTML:

$docx->embedHTML($html, array('parseAnchors' => true));

Using the previous code your internal links will work with the br tags as needed. You can read about this option on the API page (https://www.phpdocx.com/api-documentation/word-content/embed-html-Word-document-with-PHP) and the introduction doc about HTML to DOCX (https://www.phpdocx.com/documentation/introduction/html-to-word-PHP).

Regards.