[英]Custom formula list data validation
So in excel you can create a data validation rule using a list that is determined by a formula.因此,在 excel 中,您可以使用由公式确定的列表来创建数据验证规则。 Any know how to do this using C# and ClosedXML?
有谁知道如何使用 C# 和 ClosedXML 做到这一点?
You can implement your own collection using ICollection
or IList
and implement your rules for add and remove operations.您可以使用
ICollection
或IList
实现自己的集合,并实现添加和删除操作的规则。
public class myList : IList
{
private List<string> _list;
public myList()
{
_list = new List<string>();
}
public object this[int index] { get => _list[index]; set => throw new NotImplementedException(); }
public bool IsFixedSize => throw new NotImplementedException();
public bool IsReadOnly => throw new NotImplementedException();
public int Count => throw new NotImplementedException();
public bool IsSynchronized => throw new NotImplementedException();
public object SyncRoot => throw new NotImplementedException();
public int Add(object value)
{
throw new NotImplementedException();
}
public void Clear()
{
throw new NotImplementedException();
}
public bool Contains(object value)
{
throw new NotImplementedException();
}
public void CopyTo(Array array, int index)
{
throw new NotImplementedException();
}
public IEnumerator GetEnumerator()
{
throw new NotImplementedException();
}
public int IndexOf(object value)
{
throw new NotImplementedException();
}
public void Insert(int index, object value)
{
throw new NotImplementedException();
}
public void Remove(object value)
{
throw new NotImplementedException();
}
public void RemoveAt(int index)
{
throw new NotImplementedException();
}
}
For some operations which don't need any change, implement them using same operation in _list
, like index setter.对于一些不需要任何更改的操作,使用
_list
相同操作来实现它们,例如索引设置器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.