Replies: 3   Views: 634
How do i create an inline combobox?
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 radu97  · 27-01-2021 - 14:15

Hello all! How do i create an inline combobox / dropdown? 

I've tried the following:

  1. 1. Creating a WordFragment with a std element  and add it using the "replaceVariableByWordFragment" function. It worked but it removed the entire paragraph.
  2. 2. Creating a select form element. It also worked but i am not able to change its selection if the document is not locked. 


Is there a way to create an inline std element or a form element which is editable even if the document is not locked? Thank you!

Posted by admin  · 27-01-2021 - 14:40


What version and license of phpdocx are you using? If you are using a purchased license, please to contact[at] the user or email of the user that purchased the license.


Posted by radu97  · 27-01-2021 - 14:53

I am using the trial version. Thank you

Posted by admin  · 27-01-2021 - 15:30


You can use the following methods to add form type elements to the document:

addStructuresDocumentTag contents are added as block contents. addFormElement contents can be added as inline elements, for example:

$selectOptions = array(
        'selectOptions' => array('One', 'Two', 'Three', 'Four'), 
        'fontSize' => 14,
        'color' => 'C90000', 
        'bold' => true, 
$contentFragment = new WordFragment($docx);
$contentFragment->addFormElement('select', $selectOptions);

$text[] = array(
        'text' => 'Text content with a select field: ',
        'bold' => true,

$text[] = $contentFragment;


The value of this element can be changed if the DOCX is locked or not. If the DOCX isn't locked you can do double click on the element and use the arrows to set the first value to be displayed reordering the values or adding new ones or removing the existing ones.