-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to save lines from "textarea"? #2276
Comments
I actually had the exact same problem yesterday, and I fixed it based off this comment: I ended up doing the following in my controller: public function process_newline_text($string)
{
$lines = explode("\n", $string);
$textrun = new TextRun();
$textrun->addText(array_shift($lines));
foreach ($lines as $line) {
$textrun->addTextBreak();
$textrun->addText(htmlspecialchars($line));
}
return $textrun;
}
$templateProcessor = new TemplateProcessor('template.docx');
$templateProcessor->setComplexValue(
'someField',
$this->process_newline_text($paragraph)
); The |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Now all text from "textarea" is saved as just solid text. How can I make the text stay in lines?
<textarea id="program_description" name="program_description" placeholder="Program description"></textarea>
`$program_description = $_POST['program_description'];
$document->setValue('program_description', $program_description);`
The text was updated successfully, but these errors were encountered: