如何使用C#在Excel中创建从属下拉列表

时间:2017-03-20 17:03:05

标签: c# excel model-view-controller

我有两个依赖表..需要通过使用c#.Made Drop Down Cell添加验证来在Excel单元格中创建依赖ddl,但请根据Provider Cell值帮助生成Product Cell级联或依赖单元格。

worksheet.DataValidations.Add(new DataValidation(worksheet.Cells.GetSubrange("L" + i.ToString(), "L" + i.ToString()))
{
    Type = DataValidationType.List,
    Operator = DataValidationOperator.Between,
    Formula1 = RangeProviders,
    InputMessageTitle = "Provider",
    InputMessage = "Please select a Provider",
    ErrorTitle = "Invalid Provider",
    ErrorMessage = "Provider must be one from the list."
});

worksheet.DataValidations.Add(new DataValidation(worksheet.Cells.GetSubrange("M" + i.ToString(), "M" + i.ToString()))
{
    Type = DataValidationType.List,
    Operator = DataValidationOperator.Between,
    Formula1 = RangeProducts,
    InputMessageTitle = "Product",
    InputMessage = "Please select a Product",
    ErrorTitle = "Invalid Product",
    ErrorMessage = "Product must be one from the list."
});

0 个答案:

没有答案
相关问题