, , . , RadioButtons, .
, Interop System.Object, ( VS System.Object[*]), , , ), ControlFormat.List[], 1-. !
dropDown
Worksheet worksheet = (Worksheet)workbook.Worksheets[worksheetName];
var control = worksheet.Shapes.Item(dropdownName).ControlFormat;
var vl = GetDropdownList(control);
var targetIndex = IndexOfMatch(targetValue, vl);
control.Value = targetIndex;
private List<string> GetDropdownList(ControlFormat control)
{
var newList = new List<string>();
for (int i = 1; i <= control.ListCount; i++)
{
newList.Add((string)control.List[i]);
}
return newList;
}
private int IndexOfMatch(string targetValue, List<string> vals)
{
int indexMatch = vals.IndexOf(targetValue);
return ++indexMatch;
}
OpenXmlSDK - d **** d, , . DataValidation, , , , SharedString SharedStringTable - , , . .
Exel: .