Is it posssible, using addFormElement, to display a label alongside the form element?
For example, if I use addFormElement to insert a checkbox, how would I position text directly inline alongside it?
Is it posssible, using addFormElement, to display a label alongside the form element?
For example, if I use addFormElement to insert a checkbox, how would I position text directly inline alongside it?
Hello,
You can generate an array of contents to add inline contents in the same paragraph (using WordFragments and text contents).
For example, to add a checkbox and a text content:
$docx = new CreateDocx();
$checkboxFragment = new WordFragment($docx);
$checkboxOptions = array('fontSize' => 12, 'defaultValue' => true);
$checkboxFragment->addFormElement('checkbox', $checkboxOptions);
$text = array();
$text[] = $checkboxFragment;
$text[] = array(
'text' => ' A checkbox',
'bold' => true,
);
$docx->addText($text);
$docx->createDocx('output.docx');
In addition to this sample, we recommend you check the following:
If you need further support about this task we can generate a more sophisticated example.
Regards.