Add

Add(sText, [sValue], [nIndex]) → { boolean }

Adds a new value to the combo box / dropdown list content control.

Parameters:

Name Type Default Description
sText string

The display text for the list item.

sValue string sText

The list item value.

nIndex number this.GetElementsCount()

A position where a new value will be added.

Returns:

Type
boolean

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
Api.pluginMethod_AddContentControlList(1, [{Display: "Item1_D", Value: "Item1_V"}, {Display: "Item2_D", Value: "Item2_V"}], {"Id": 100, "Tag": "CC_Tag", "Lock": 3});
var aContentControls = oDocument.GetAllContentControls();
var oContentControlList = aContentControls[0].GetDropdownList();
oContentControlList.Add("Item3_D", "Item3_V", 2);
oDocument.AddElement(0, oContentControlList);
builder.SaveFile("docx", "Add.docx");
builder.CloseFile();

Resulting document