更新时间:2022-10-18 23:18:58
谢谢你的提问。
通常,open xml验证功能支持在OpenXmlElement / OpenXmlPart / OpenXmlPackage上进行验证。
您可以直接调用它,例如:OpenXmlValidator validator = new OpenXmlValidator(FileFormatVersions.Office2007);
IEnumerable< ValidationErrorInfo> errorList = validator.Validate(cell);
首先需要检索工作表中的Cell元素。
I want to add data validation to a cell in Excel 2007 using Open Xml SDK 2.0? Does anyone know how to do this? Is there a sample for this somewhere?
Thanks a lot!
Thanks for your question.
I'm not quite clear about your requirement, can you provide more info for you scenario?
Generally, The open xml validation feature support validation on an OpenXmlElement/OpenXmlPart/OpenXmlPackage.
You can directly call it , like:OpenXmlValidator validator = new OpenXmlValidator(FileFormatVersions.Office2007); IEnumerable<ValidationErrorInfo> errorList= validator.Validate(cell);
and firstly you need to retrieve the Cell element in the worksheet.