DocumentBuilderInsertComboBox Method
Inserts a combobox form field at the current position.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.10
Syntax
public FormField InsertComboBox(
	string name,
	string[] items,
	int selectedIndex
)

Parameters

name
Type: SystemString
The name of the form field. Can be an empty string. The value longer than 20 characters will be truncated.
items
Type: SystemString
The items of the ComboBox. Maximum is 25 items.
selectedIndex
Type: SystemInt32
The index of the selected item in the ComboBox.

Return Value

Type: FormField
The form field node that was just inserted.
Remarks

If you specify a name for the form field, then a bookmark is automatically created with the same name.

Examples
Shows how to insert a combobox form field into a document.
[C#]

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

String[] items = { "One", "Two", "Three" };
builder.InsertComboBox("DropDown", items, 0);
Examples
Builds a sample form to fill.
[C#]

DocumentBuilder builder = new DocumentBuilder();

// Insert a text form field for input a name.
builder.InsertTextInput("", TextFormFieldType.Regular, "", "Enter your name here", 30);

// Insert two blank lines.
builder.Writeln("");
builder.Writeln("");

string[] items =
{
    "-- Select your favorite footwear --", "Sneakers", "Oxfords", "Flip-flops", "Other",
    "I prefer to be barefoot"
};

// Insert a combo box to select a footwear type.
builder.InsertComboBox("", items, 0);

// Insert 2 blank lines.
builder.Writeln("");
builder.Writeln("");

builder.Document.Save(ArtifactsDir + "DocumentBuilder.CreateForm.doc");
See Also