Forum


Replies: 2   Views: 7400
How to add line break between two words
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 Sven May  · 21-02-2015 - 17:03

Hello! I have a table with columns. In one cell I have to display two words with line breaks: Example: First word Second word How I try: $valueFragment = new WordFragment($docx); $text = array(); $text[] = array('text'=>'optional','bold'=>true,'caps'=>true,'color'=>'FFFFFF','columnBreak'=>'after'); $text[] = array('text'=>"\n"); $text[] = array_merge(array('text'=>'Word fragment'), $properties); $valueFragment->addText($text); $valueCell = array('value'=>$valueFragment, 'width' => 3000, 'borderColor'=>(('N' == $isOn])?'9B9B9B':'000000'), 'vAlign'=> 'center', 'backgroundColor'=>(($isOptional)?'D2D2D2':'FFFFFF'), 'border'=>'single'); $table []= array($descriptionCell, $valueCell); $trProperties []= array('cantSplit'=>true); $tableOptions = array('font'=>'Arial','tableAlign'=>'left'); $docx->addTable($table, $tableOptions, $trProperties); The cell content could not be HTML content only text content. I tired to add this: $text[] = array('text'=>$docx->addBreak(array('type'=>'line'))); but not helpd. Could you give me any soultion on this problem? Thank you