A family of Microsoft word processing software products for creating web, email, and print documents.
Alternatively, you can use Spire.Doc to insert a dropdown list content control to Word documents. The code is as follows.
using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields;
namespace InsertDropdownList
{
class Program
{
static void Main(string[] args)
{
//Create a Document object
Document doc = new Document();
//Add a section and a paragraph
Section section = doc.AddSection();
Paragraph paragraph = section.AddParagraph();
//Add dropdown list content control
StructureDocumentTagInline sd = new StructureDocumentTagInline(doc);
paragraph.ChildObjects.Add(sd);
sd.SDTProperties.SDTType = SdtType.DropDownList;
SdtDropDownList sddl = new SdtDropDownList();
sddl.ListItems.Add(new SdtListItem("USA"));
sddl.ListItems.Add(new SdtListItem("Canada"));
sd.SDTProperties.ControlProperties = sddl;
TextRange textRange = new TextRange(doc);
textRange.Text = sddl.ListItems[0].DisplayText;
sd.SDTContent.ChildObjects.Add(textRange);
//Save to file
doc.SaveToFile("DropdownList.docx", FileFormat.Docx2013);
}
}
}