返回首页
坑
cell中默认显示是不换行的,即便内容有换行符\n也不行 需要设置样式
需要设置样式 ws.Cells["A1:A2"].Style.WrapText = true; //false by default
高速
给单元格设置下拉数据 供选择
foreach (KeyValuePair> item in property)
{
var val = sheet.DataValidations.AddListValidation(sheet.Cells[row, item.Key].Address);//设置下拉框显示的数据区域
foreach (string value in item.Value)
{ val.Formula.Values.Add(value); }
}
注意 Formula.Values中的List<string>集合值不能为Null 否则会报错