Forum


Replies: 10   Views: 8549
Please fix 'parselinebreaks' option
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 quasydoc  · 22-01-2016 - 14:25

We also ran into this issue.

To reproduce it, try saving the contents of a textarea form field containing multiple lines of text to the database. If you then retrieve the field, and feed it into the replaceVariableByText() function with the parseLineBreaks option 'true', line breaks are not detected by phpdocx.

What "str_replace(array('\n\r', '\r\n', '\n', '\r'), '__LINEBREAK__', $value);" in the phpdocx source code does is look for the character '\', followed by 'r', followed by character '\', followed by 'n', or in hex notation: 5C 72 5C 6E, instead of 0D 0A.

It should work in the same fashion as the nl2br() php function.