SetValue

SetValue(sValue) → { boolean }

Sets a String that represents the value of a list item for the combo box / dropdown list content control.

Parameters:

Name Type Description
sValue string

The value of a list item.

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();
oDocument.AddElement(0, oContentControlList);
var oItem = oContentControlList.GetItem(0);
oItem.SetValue("Item1_V_new");
var oParagraph = Api.CreateParagraph();
oParagraph.AddText("The first item value: " + oItem.GetValue());
oDocument.Push(oParagraph);
builder.SaveFile("docx", "SetValue.docx");
builder.CloseFile();

Resulting document