I am using PHPWord from within PHP to generate a word docment. I do use addHtml to transform some Mysql text containing multiple lines into a Word paragraph.
My input text contains:
<pre>
Lorem ipsum dolor sit amet,
<span style="font_weight:bold">consectetur adipiscing elit.</span>
Quisque pretium mi a risus interdum, eu mollis nulla viverra.
</pre>
Each line is separated with a carriage return (n
). I tried to process the lines one by one (adding a n
for each line, or use the complete text, result is the same.
Whatever I use (nl2br
or str_replace
) to transform the n
into <br />
before handling addHtml generates:
Meaning a double paragraph separator instead of a single line separator.
How can this be solved? Or is this a known issue?