Spread for silverlight 数据校验
怎么样在Spread for silverlight 7.0 中 实现excel 批量导入后的数据上传,请各位大牛指点! 回复 1楼songhx的帖子“怎么样在Spread for silverlight 7.0 中 实现excel 批量导入后的数据上传,”
刚才我们通过电话,数据上传指的是什么?数据校验还是?
感觉问题和我们刚才沟通的不太符合。 版主,不好意思,“数据上传”指的就是咱们沟通的“数据校验” 回复 3楼songhx的帖子
你好,感谢反馈。我理解问题分为以下两个步骤:
1.使用 Spread 打开 Excel,可以参考:
http://demo.gcpowertools.com.cn/spread/silverlight/controlexplorer/Index.html#ExcelIE/ExcelIE
2.对特定单元格进行数据校验,详细可以参考帮助文档:Using Data Validation部分,下面是校验测试代码:
C#
gcSpreadSheet1.HighlightInvalidData = true;
var valid = GrapeCity.Windows.SpreadSheet.Data.DataValidator.CreateListValidator("5,10,15,20");
gcSpreadSheet1.Sheets.Cells.DataValidator = valid;
gcSpreadSheet1.Sheets.Cells.Text = "5, 10, 15, and 20 are valid numbers.";
var valid1 = GrapeCity.Windows.SpreadSheet.Data.DataValidator.CreateNumberValidator(GrapeCity.Windows.SpreadSheet.Data.ComparisonOperator.GreaterThan, "5", "20", true);
gcSpreadSheet1.Sheets.Cells.DataValidator = valid1;
gcSpreadSheet1.Sheets.Cells.Text = "A number greater than 5 is valid.";
var valid2 = GrapeCity.Windows.SpreadSheet.Data.DataValidator.CreateTextLengthValidator(GrapeCity.Windows.SpreadSheet.Data.ComparisonOperator.GreaterThan, "4", "20");
gcSpreadSheet1.Sheets.Cells.DataValidator = valid2;
gcSpreadSheet1.Sheets.Cells.Text = "Type more than four characters.";
VB.NET
GcSpreadSheet1.HighlightInvalidData = True
Dim valid = GrapeCity.Windows.SpreadSheet.Data.DataValidator.CreateListValidator("5,10,15,20")
GcSpreadSheet1.Sheets(0).Cells(0, 1).DataValidator = valid
GcSpreadSheet1.Sheets(0).Cells(0, 0).Text = "5, 10, 15, and 20 are valid numbers."
Dim valid1 = GrapeCity.Windows.SpreadSheet.Data.DataValidator.CreateNumberValidator(GrapeCity.Windows.SpreadSheet.Data.ComparisonOperator.GreaterThan, "5", "20", True)
GcSpreadSheet1.Sheets(0).Cells(1, 1).DataValidator = valid1
GcSpreadSheet1.Sheets(0).Cells(1, 0).Text = "A number greater than 5 is valid."
Dim valid2 = GrapeCity.Windows.SpreadSheet.Data.DataValidator.CreateTextLengthValidator(GrapeCity.Windows.SpreadSheet.Data.ComparisonOperator.GreaterThan, "4", "20")
GcSpreadSheet1.Sheets(0).Cells(2, 1).DataValidator = valid2
GcSpreadSheet1.Sheets(0).Cells(2, 0).Text = "Type more than four characters."
回复 3楼songhx的帖子
请问问题是否解决?为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢
http://gcdn.gcpowertools.com.cn/attachment.aspx?attachmentid=10062
页:
[1]