Hi.
I tried to do the same for the example in this article, but there was no drop-down list. It also did not accept the values on the list.
CellIndex dataValidationRuleCellIndex =
new
CellIndex(0, 0);
ListDataValidationRuleContext context =
new
ListDataValidationRuleContext(worksheet, dataValidationRuleCellIndex);
context.InputMessageTitle =
"Restricted input"
;
context.InputMessageContent =
"The input is restricted to the week days."
;
context.ErrorStyle = ErrorStyle.Stop;
context.ErrorAlertTitle =
"Wrong value"
;
context.ErrorAlertContent =
"The entered value is not valid. Allowed values are the week days!"
;
context.InCellDropdown =
true
;
context.Argument1 =
"Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday"
;
ListDataValidationRule rule =
new
ListDataValidationRule(context);
worksheet.Cells[dataValidationRuleCellIndex].SetDataValidationRule(rule);