CreateDropDownListContentControl
Creates a new drop-down list container with the given list of options.
Syntax
expression.CreateDropDownListContentControl(list, selected);
expression
- A variable that represents a Api class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
list | Optional | ContentControlListItem[] | An array of objects representing the items in the drop-down list. | |
selected | Optional | number | -1 | The selected item index. |
Returns
Example
This example shows how to create a combo box content control.
- Code
- Result
let doc = Api.GetDocument();
let cc = Api.CreateDropDownListContentControl([{display: 'one', value: '1'}, {display: 'two', value: '2'}], 1);
let paragraph = Api.CreateParagraph();
paragraph.Push(cc);
doc.Push(paragraph);