跳到主要内容

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

NameRequired/OptionalData typeDefaultDescription
listOptionalContentControlListItem[]An array of objects representing the items in the drop-down list.
selectedOptionalnumber-1The selected item index.

Returns

ApiInlineLvlSdt

Example

This example shows how to create a combo box content control.

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);