Forum


Replies: 4   Views: 546
Question about adding form elements on the same line as text
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  · 20-04-2023 - 09:25

I have tried the approach like this :

$item = new WordFragment($docx);
$content1 = new WordFragment($docx);
$content2 = new WordFragment($docx);
$content1->addText('1.1', ['font' => 'Arial', 'fontSize' => 8, 'indent_left' => 10]);
$content2->addFormElement('select', ['selectOptions' => [' 0 ', ' 1 ', ' 2 ', ' 3 ']]);
$content = array();
$content[] = $content1;
$content[] = $content2;
$item->addText($content);

But the text and the form element are still not in the same line. Is there anything wrong with the code?