UPDATE: phpdocx 6.0 added support for '\n\r', '\r\n', '\n', '\r', "\n\r", "\r\n", "\n", "\r" when using the parseLineBreaks option. Previous versions only support literal breaks: '\n\r', '\r\n', '\n', '\r'
UPDATE: phpdocx 6.0 added support for '\n\r', '\r\n', '\n', '\r', "\n\r", "\r\n", "\n", "\r" when using the parseLineBreaks option. Previous versions only support literal breaks: '\n\r', '\r\n', '\n', '\r'
UPDATE: phpdocx 6.0 added support for '\n\r', '\r\n', '\n', '\r', "\n\r", "\r\n", "\n", "\r" when using the parseLineBreaks option. Previous versions only support literal breaks: '\n\r', '\r\n', '\n', '\r'
UPDATE: phpdocx 6.0 added support for '\n\r', '\r\n', '\n', '\r', "\n\r", "\r\n", "\n", "\r" when using the parseLineBreaks option. Previous versions only support literal breaks: '\n\r', '\r\n', '\n', '\r'
I confirm that this is still an issue. Replacing the single quotes by double quotes works and fixes this issue.
We had this issue on our development environment as well as on our production environments.
I have replaced this in the CreatDocxFromTemplate file, and hoping this won't break in a future update.
Ps: using PHP 5.6.x on Ubuntu/CentOS
UPDATE: phpdocx 6.0 added support for '\n\r', '\r\n', '\n', '\r', "\n\r", "\r\n", "\n", "\r" when using the parseLineBreaks option. Previous versions only support literal breaks: '\n\r', '\r\n', '\n', '\r'
Hello,
We have tested it again using fresh installations of Ubuntu and CenOS and it works perfectly. We'd need to check it directly on your server, please write to contact[at]phpdocx.com
The most common mistake when working with parseLineBreaks is that you need to set line breaks as '\n' not "\n".
Regards.
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.
UPDATE: phpdocx 6.0 added support for '\n\r', '\r\n', '\n', '\r', "\n\r", "\r\n", "\n", "\r" when using the parseLineBreaks option. Previous versions only support literal breaks: '\n\r', '\r\n', '\n', '\r'