hdml指的是什么接口
285
2022-06-21
#region 添加有效性
DataTable dt = LAbll.LogisticsAccounts(DeptId); //查数据
if (dt.Rows.Count < 20) //有效性字符限制255,一组字符12加分割符=13
{
string[] strs = {};
for (int l = 0; l < dt.Rows.Count; l++)
{
string[] sigle = { "" + dt.Rows[l]["XXX"].ToString() + "" };
strs = strs.Concat(sigle).ToArray();
}
XSSFDataValidationHelper dvHelper = new XSSFDataValidationHelper((XSSFSheet)sheetHead);
XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint)dvHelper.CreateExplicitListConstraint(strs);
CellRangeAddressList addressList = new CellRangeAddressList(1, 1, 3, 3); //(开始行,结束行,开始列,结束列)
XSSFDataValidation validation = (XSSFDataValidation)dvHelper.CreateValidation(dvConstraint, addressList);
validation.CreatePromptBox("输入提示", "请从下拉列表中选择XXX");
validation.CreateErrorBox("输入值有误", "请从下拉列表中选择XXX");
validation.SuppressDropDownArrow = true;
validation.ShowErrorBox = true;
validation.ShowPromptBox = true;
sheetHead.AddValidationData(validation);
}
#endregion
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~