Forum


Replies: 1   Views: 268
Wrap texts when using modifyinputfields
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 tjchen  · 03-12-2021 - 05:53

For example:
$textfield = "first" . "\n" . "second" . "\n" . "third";
$data = array( 'textfield' => $textfield);
$docx->modifyInputFields($data);
I want the result to be:
first
second
third
but the result will be:
first second third
How can i fix it? Thanks.

Posted by admin  · 03-12-2021 - 06:50

Hello,

The current version of modifyInputFields doesn't include a parseLineBreaks option to add contents with line breaks (other methods such as replaceVariableByText or replaceTableVariable include it). We have added a task to be added in a future release of phpdocx.

If you are interested on a custom development of this specific task, please purchase a pack of 8 tickets (https://www.phpdocx.com/support) and open a ticket with this same request. The dev team will develop this feature and send you the updated class with a sample.

Regards.