Forum


Replies: 1   Views: 1040
Inserting variable with enters
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 Exorion  · 10-12-2020 - 14:22

Hi guys! If i'm inserting a variable with enter (\n) in it, the newline not started and i'm continue from it - how i can make a line break inserting from variables?

Thanks

Posted by admin  · 10-12-2020 - 16:52

Hello,

You can replace a placeholder by a text with line breaks enabling the parseLineBreaks option available in some template methods (such as replaceVariableByText) or replacing the placeholder by a WordFragment with line breaks. In the package ahd the documentation pages you can find samples using both approaches; for example on the API page of replaceVariableByText: https://www.phpdocx.com/api-documentation/templates/replace-variable-text-Word-document.

Regards.