I'm trying to user the function with a multilne html and doesn't work.... no line breaks...
Thanks,
🏷️ Limited Offer: 25% OFF 🏷️
First 100 purchases only — Special discount!
Use this coupon on checkout: PHPDXPJ_D1SC1N5T
Get it nowI'm trying to user the function with a multilne html and doesn't work.... no line breaks...
Thanks,
Hello,
What method are you using? replaceVariableByHTML or replaceVariableByWordFragment?
In any case, both methods add line breaks correctly.
For example, using replaceVariableByHTML:
$docx = new CreateDocxFromTemplate('template.docx');
$docx->replaceVariableByHTML('VAR', 'block', '<p>A new content<br> and more content</p>');Or using replaceVariableByWordFragment:
$docx = new CreateDocxFromTemplate('template.docx');
$htmlWordFragment = new WordFragment($docx, 'document');
$htmlWordFragment->embedHTML('<p>A new content<br> and more content</p>');
$docx->replaceVariableByWordFragment(array('VAR' => $htmlWordFragment));In both cases the variable is replaced correctly by the new HTML and the line breaks are added correctly.
Please post the most simple code you are running so we can check it. Please note that HTML requires adding br tags to generate line breaks or using block contents. "\n" or "\r\n" breaks can't be used when transforming HTML. These newline characters can be used with other template methods such as replaceVariableByText setting the parseLineBreaks option as true.
Regards.