PHPOffice / PHPWord

A pure PHP library for reading and writing word processing documents

Home Page:https://phpoffice.github.io/PHPWord/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trouble Interacting with Dropdown FormField

ysd-wilson opened this issue · comments

Hello all,

I'm using this package to create a Word document with an interactive dropdown form field. Below is a snippet of my code:

$cell = $table->addCell();
$textRun = $cell->addTextRun();
$textRun->addFormField('dropdown')->setEntries(['Choice 1', 'Choice 2', 'Choice 3'])->setValue(1);

However, when the Word document is opened, the dropdown displays the selected value ("Choice 2") but does not allow me to change the selected option interactively.

I want to create a dropdown like this:

I can see the other options when I double click on the field and they appear to be editable, but the interactivity isn't functioning as expected (Can't change option).

I've tried entering Design Mode in Word, but the issue persists. This problem occurs in the default Print Layout view in Word, and I assume it's due to some restrictions on form fields interaction in Word's viewing modes. However, this behavior is counterintuitive for my users.

Has anyone else encountered this issue or have any suggestions on what may be causing this and how to fix it? Any help or pointers would be greatly appreciated!

Thanks in advance!