excel 复选框选中
//选中checkbox事件种类
string IncidentType = dtMain.Rows.Count > 0 ? dtMain.Rows[0]["事件种类"].ToString() : "";
var IncidentTypeArray = IncidentType.Split(',');
foreach (var item in sheet.CheckBoxes)
{
Console.WriteLine("复选框名称:"+ item.Name);
for (int i = 0; i < IncidentTypeArray.Count(); i++)
{
if(item.Text== IncidentTypeArray[i])
{
item.CheckedValue = CheckValueType.Checked;
}
}
}
本文来自博客园,作者:.net&new,转载请注明原文链接:https://www.cnblogs.com/wugh8726254/p/17526890.html