Forum


Replies: 1   Views: 432
Inserting label alongside form element
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 admin  · 12-10-2023 - 15:44

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.