将验证添加到Excel工作表 [英] Add the validation to the excel sheets

查看:102
本文介绍了将验证添加到Excel工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如何将验证添加到Excel工作表..

验证是,它是输入字段,它只允许小数点后2位数积分请尽快帮助我....

喜欢2.33



解决方案
1。您需要获取要添加验证的范围。

  //  选择指定的单元格 
范围单元格= worksheet.Cells [row,column];



2.一旦获得在Range中,您可以在Range对象上调用Validation.Add方法。

  //  删除任何先前的验证 
cell.Validation.Delete();
// 添加验证,只允许选择提供的值。
cell.Validation.Add(<<<>传递所需参数>>)





有关验证方法和属性的更多信息,请参阅可从

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.validation.add(office.11​​).aspx [ ^ ]



how to add the validation to the excel sheet..
the validation is, it is the input field it allows only 2 digits after a decimal points please help me soon....
like 2.33

解决方案

1. You need get the Range for which you want to add the validation.

//Select the specified cell
Range cell = worksheet.Cells[row, column];


2. Once you get the Range, you can call the Validation.Add method on the Range object.

//Delete any previous validation
cell.Validation.Delete();
//Add the validation, that only allowes selection of provided values.
cell.Validation.Add(<<pass the required parameters>>)



More information about the Validation methods and properties is available at
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.validation.add(office.11).aspx[^]


这篇关于将验证添加到Excel工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆