Putting a Form Field inside a text box

I want to insert a form field inside a text box. I am doing this during a mail-merge, and when I find a particular field I need to put a text form field in place of the merge field.

The problem is that MS Word doesn’t seem to support the legacy style text form fields (the type you get with builder.insertTextInput()) within text boxes.

I should be clear that when I add the field, it does in fact appear in the document within the text box. If I try to protect the document from editing, though [using doc.protect(ProtectionType.ALLOW_ONLY_FORM_FIELDS, “PASSWORD”)], the field within the text box is not editable in the resulting document.
I noticed that within Word, I don’t have the option to insert a legacy text field into a text box, and if I try to copy a text field into a text box I get a pop-up dialog saying that fields cannot be placed in text boxes.

I need to do one of two things:
1. Remove the surrounding text box (there would be nothing else inside of it) and place a form field in the document positioned where the text box was. This has proven very difficult, because text boxes can be positioned in different ways and I haven’t figured out a way to do this.
2. Place a new style text input field into the doc, which is allowed to be inside of a text box.

Can you provide suggestions as to how to do either of the above?

Hi Brian,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. You can not insert FormField inside TextBox (shape).

Please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate how you want your final Word output be generated like. We will then provide you more information on this along with code.