Need to add Dropdown in Excel using ASP.NET CORE 2.0

May 23 2018 1:31 AM
I want to add dropdown list in excel sheet using asp.net core 2.0 application .I am using 
 
 using Microsoft.AspNetCore.Hosting;
MemoryStream stream = new MemoryStream();
using (ExcelPackage package = new ExcelPackage(stream))
{
ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("QuesAnsDetails");
 
I have created list values in dropdown but not able to add list values in run time 
 
var list1 = new System.Collections.Generic.List<string>();
list1.Add("Charlie");
list1.Add("Delta");
list1.Add("Echo");
var flatList = string.Join(",", list1.ToArray());
QuestionAnswerEntity questionAnswerEntity = new QuestionAnswerEntity();
questionAnswerEntity.CallDriverId = 0;
questionAnswerEntity.UserName = string.Empty;
var list = this._iQuestionAnswerBLL.GetQuestionAnswerFormat(questionAnswerEntity);
for (int i = 0; i < list.Count - 1; i++)
{
worksheet.Cells[i + 2, 1].Value = list[i].CallDriverName;
worksheet.Cells[i + 2, 2].Value = list[i].ScenarioName;
worksheet.Cells[i + 2, 3].Value = list[i].LearningActivityId;
worksheet.Cells[i + 2, 4].Value = list[i].LearningActivityName;
worksheet.Cells[i + 2, 5].Value = list[i].Question;
worksheet.Cells[i + 2, 6].Value = list[i].Answer1;
worksheet.Cells[i + 2, 7].Value = list[i].Answer2;
worksheet.Cells[i + 2, 8].Value = list[i].Answer3;
worksheet.Cells[i + 2, 9].Value = list[i].Answer4;
// worksheet.Cells[i + 2, 10].Value = list[i].CorrectAnswer;
worksheet.Cells[i + 2, 10].Value = list1
 
 }
 
 
 

Answers (1)