I have implemented Excel template download in my project. I used ClosedXML.
I have two excel sheets
Sheet1: In this sheet, I have a column called Type in which I can create Dropdown List and it is the third column.
Sheet2: In this sheet, I have a column called Types and its Range Address is: B2:B4 and it is the second column.
Types values are:
Employee
Student
Teacher
Now, I want to create a dropdown list.
I created a dropdownlist in ClosedXML and the code is:
//Getting the range of sheet 2
var range = workbook.Worksheet(2).Range(workbook.Worksheet(2).Cell(2,2).Address,workbook.Worksheet(2).Cell(4,2).Address);
//Applying sheet 2's range with sheet 1
workbook.Worksheet(1).Column(3).SetDataValidation().List(range:range);
wb.Worksheet(1).Column(3).SetDataValidation().IgnoreBlanks = true;
wb.Worksheet(1).Column(3).SetDataValidation().InCellDropdown = true;
I got the dropdown symbol at the right end of the cell but I didn't get the values in it.