I have generated code for creating excel file to generating each cell for the row in MVC.
I have more than 20000 records that time 15 min required for generating one excel file.so i want minimum time for downloading excel file.their is column generated is dynamic.
- public ActionResult ExportToExcel(int SurveyId)
- {
- var _checlAuth = this.CheckAuthentication();
- if (_checlAuth != null)
- {
-
- return _checlAuth;
- }
-
-
- string fileName = System.Web.Configuration.WebConfigurationManager.AppSettings["ExcelPath"].ToString() + "\\SurveyReport_" + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + DateTime.Now.Millisecond + "_" + SurveyId + ".xlsx";
-
-
-
-
- SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.
- Create(fileName, SpreadsheetDocumentType.Workbook);
-
-
- WorkbookPart workbookpart = spreadsheetDocument.AddWorkbookPart();
- workbookpart.Workbook = new Workbook();
-
-
- WorksheetPart worksheetPart = workbookpart.AddNewPart();
- worksheetPart.Worksheet = new Worksheet(new SheetData());
-
- Sheets sheetsStudentDetails = spreadsheetDocument.WorkbookPart.Workbook.
- AppendChild(new Sheets());
-
- Sheet sheetStudentDetail = new Sheet()
- {
- Id = spreadsheetDocument.WorkbookPart.
- GetIdOfPart(worksheetPart),
- SheetId = 1,
- Name = "Survey Details",
- };
-
- SheetData sheetData = worksheetPart.Worksheet.GetFirstChild();
-
- Row row = new Row();
- sheetsStudentDetails.Append(sheetStudentDetail);
-
-
- var Question = new BussinessLogic.Admin.UserSurvey(new UserSurveyRepository(new CRMContext())).GetAllUserSurvey().Where(m => m.SurveyId == SurveyId);
-
-
- int i = 1;
- int j = 1;
- int kk = 2;
- var countResponse= new BussinessLogic.Answer.Answer(new AnswerRepository(new CRMContext())).GetAllAnswer().Where(a => a.SurveyId == SurveyId).Select(a => a.EachSurveyUniqueNo).Distinct().ToList();
- var AllQAnswer = new BussinessLogic.Answer.Answer(new AnswerRepository(new CRMContext())).GetAllAnswer();
- var AllQueAnswerOption = new BussinessLogic.Admin.QuestionAnswer(new QuestionAnswerRepository(new CRMContext())).GetAllQuestionAnswer();
- row.Append(ConstructCell("Conducted Survey Id", CellValues.String));
- row.Append(ConstructCell("Survey Name", CellValues.String));
- row.Append(ConstructCell("Survey Id", CellValues.String));
-
- row.Append(ConstructCell("Date & Time", CellValues.String));
- row.Append(ConstructCell("Submitted By", CellValues.String));
-
- foreach (var q in Question)
- {
- var QuestionRow = new BussinessLogic.Admin.QuestionAnswer(new QuestionAnswerRepository(new CRMContext())).GetAllQuestionAnswer().Where(k => k.QuestionId == q.Id && k.ColumnOption == null);
- Row rans = new Row();
- if (q.QuestionTypeId == 1)
- {
- row.Append(ConstructCell(q.QuestionText, CellValues.String));
- }
- if (q.QuestionTypeId == 2)
- {
- var optanser = AllQueAnswerOption.Where(a => a.QuestionId == q.Id).ToList();
- foreach (var anss in optanser)
- {
- row.Append(ConstructCell(q.QuestionText + ": " + anss.AnswerOption, CellValues.String));
- }
- }
- if (q.QuestionTypeId == 3)
- {
- row.Append(ConstructCell(q.QuestionText, CellValues.String));
- }
- if (q.QuestionTypeId == 5)
- {
- var optanser = AllQueAnswerOption.Where(a => a.QuestionId == q.Id).ToList();
- foreach (var anss in optanser)
- {
- row.Append(ConstructCell(q.QuestionText + ": " + anss.AnswerOption, CellValues.String));
- }
- }
- if (q.QuestionTypeId == 6)
- {
- row.Append(ConstructCell(q.QuestionText, CellValues.String));
- }
- if (q.QuestionTypeId == 7)
- {
- var optanser = AllQueAnswerOption.Where(a => a.QuestionId == q.Id).ToList();
- foreach (var anss in optanser)
- {
- row.Append(ConstructCell(q.QuestionText + ": " + anss.AnswerOption, CellValues.String));
- }
- }
- if (q.QuestionTypeId == 8)
- {
- var optanser = AllQueAnswerOption.Where(a => a.QuestionId == q.Id).ToList();
- foreach (var anss in optanser)
- {
- row.Append(ConstructCell(q.QuestionText + ": " + anss.AnswerOption, CellValues.String));
- }
- }
- if (q.QuestionTypeId == 9)
- {
- var optanser = AllQueAnswerOption.Where(a => a.QuestionId == q.Id).ToList();
- foreach (var anss in optanser)
- {
- row.Append(ConstructCell(q.QuestionText + ": " + anss.AnswerOption, CellValues.String));
- }
- }
- if (q.QuestionTypeId == 10)
- {
- var optanser = AllQueAnswerOption.Where(a => a.QuestionId == q.Id && a.ColumnOption==null).ToList();
- foreach (var anss in optanser)
- {
- foreach(var colum in AllQueAnswerOption.Where(a=>a.QuestionId==q.Id && a.AnswerOption==null).ToList())
- {
- row.Append(ConstructCell(q.QuestionText + ":- " + anss.AnswerOption + " : " + colum.ColumnOption, CellValues.String));
- }
- }
- }
- if (q.QuestionTypeId == 11)
- {
- var optanser = AllQueAnswerOption.Where(a => a.QuestionId == q.Id && a.ColumnOption == null && a.DataOptions==null).ToList();
- foreach (var anss in optanser)
- {
- foreach (var colum in AllQueAnswerOption.Where(a => a.QuestionId == q.Id && a.AnswerOption == null && a.DataOptions==null).ToList())
- {
- row.Append(ConstructCell(q.QuestionText + ":- " + anss.AnswerOption + " : " + colum.ColumnOption, CellValues.String));
- }
- }
- }
- if (q.QuestionTypeId == 12)
- {
- var optanser = AllQueAnswerOption.Where(a => a.QuestionId == q.Id && a.ColumnOption == null && a.DataOptions==null).ToList();
- foreach (var anss in optanser)
- {
- foreach (var colum in AllQueAnswerOption.Where(a => a.QuestionId == q.Id && a.AnswerOption == null && a.DataOptions==null).ToList())
- {
- row.Append(ConstructCell(q.QuestionText + ":- " + anss.AnswerOption + " : " + colum.ColumnOption, CellValues.String));
- }
- }
- }
- if (q.QuestionTypeId == 13)
- {
- var optanser = AllQueAnswerOption.Where(a => a.QuestionId == q.Id && a.ColumnOption == null).ToList();
- foreach (var anss in optanser)
- {
- foreach (var colum in AllQueAnswerOption.Where(a => a.QuestionId == q.Id && a.AnswerOption == null).ToList())
- {
- row.Append(ConstructCell(q.QuestionText + ":- " + anss.AnswerOption + " : " + colum.ColumnOption, CellValues.String));
- }
- }
- }
- if (q.QuestionTypeId == 14)
- {
- var optanser = AllQueAnswerOption.Where(a => a.QuestionId == q.Id && a.ColumnOption == null).ToList();
- foreach (var anss in optanser)
- {
- foreach (var colum in AllQueAnswerOption.Where(a => a.QuestionId == q.Id && a.AnswerOption == null).ToList())
- {
- row.Append(ConstructCell(q.QuestionText + ":- " + anss.AnswerOption + " : " + colum.ColumnOption, CellValues.String));
- }
- }
- }
- if (q.QuestionTypeId == 15)
- {
- row.Append(ConstructCell(q.QuestionText, CellValues.String));
- }
-
- }
- sheetData.AppendChild(row);
- int count = 1;
- var alluser = new BussinessLogic.User.User(new Repository.UserRepository(new CRMContext())).GetAllUsers();
- var allsurvey = new BussinessLogic.Admin.Survey(new SurveyRepository(new CRMContext())).GetAllSurvey().Where(a=>a.Id==SurveyId).FirstOrDefault();
- foreach (var co in countResponse)
- {
- Row rans1 = new Row();
- rans1.Append(ConstructCell(co.ToString(), CellValues.String));
-
- if (allsurvey.SurveyName!=null)
- {
- rans1.Append(ConstructCell(allsurvey.SurveyName, CellValues.String));
- rans1.Append(ConstructCell(allsurvey.Id.ToString(), CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell("None", CellValues.String));
- }
- var surveyInfo = AllQAnswer.Where(a => a.EachSurveyUniqueNo == co).FirstOrDefault();
- if(surveyInfo!=null)
- {
- rans1.Append(ConstructCell(surveyInfo.CreatedDate.ToString(), CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell("None", CellValues.String));
- }
- var userNm = alluser.Where(a => a.id == surveyInfo.UserId).FirstOrDefault();
- if(userNm!=null)
- {
- rans1.Append(ConstructCell(userNm.name + " " + userNm.LastName, CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell("None", CellValues.String));
- }
- foreach (var qq in Question)
- {
- var QuestionRow1 = new BussinessLogic.Admin.QuestionAnswer(new QuestionAnswerRepository(new CRMContext())).GetAllQuestionAnswer().Where(k => k.QuestionId == qq.Id && k.ColumnOption == null);
-
- if (qq.QuestionTypeId == 1)
- {
- var openeded = AllQAnswer.Where(a => a.QuestionId == qq.Id && a.EachSurveyUniqueNo == co).FirstOrDefault();
- if (openeded != null)
- {
- var ansopt = AllQueAnswerOption.Where(a => a.Id == openeded.SelectedAnswerOptionId && a.QuestionId == openeded.QuestionId).FirstOrDefault();
- if(ansopt.AnswerOption.Equals("Other (Please specify)"))
- {
- rans1.Append(ConstructCell(openeded.isOtherField, CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell(ansopt.AnswerOption, CellValues.String));
- }
-
-
- }
- else
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
- if(qq.QuestionTypeId==2)
- {
- var ans = AllQAnswer.Where(m => m.QuestionId == qq.Id && m.EachSurveyUniqueNo == co).ToList();
- if (ans.Count() == 0)
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id).ToList())
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
-
- }
- else
- {
- foreach (var da in AllQueAnswerOption.Where(m=>m.QuestionId==qq.Id).ToList())
- {
- var Ques = AllQAnswer.Where(a => a.QuestionId == da.QuestionId && a.EachSurveyUniqueNo == co && a.SelectedAnswerOptionId == da.Id).FirstOrDefault();
- if(Ques!=null)
- {
- var ansopt = AllQueAnswerOption.Where(a => a.Id == Ques.SelectedAnswerOptionId && a.QuestionId == Ques.QuestionId).FirstOrDefault();
- if(ansopt.AnswerOption.Equals("Other (Please specify)"))
- {
- rans1.Append(ConstructCell(Ques.isOtherField, CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell(da.AnswerOption, CellValues.String));
- }
-
- }
- else
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
- }
- }
- if (qq.QuestionTypeId == 3)
- {
- var openeded = AllQAnswer.Where(a => a.QuestionId == qq.Id && a.EachSurveyUniqueNo == co).FirstOrDefault();
- if (openeded != null)
- {
- if (openeded.Description == null)
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell(openeded.Description, CellValues.String));
- }
- }
- else
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
- if (qq.QuestionTypeId == 5)
- {
- var ans = AllQAnswer.Where(m => m.QuestionId == qq.Id && m.EachSurveyUniqueNo == co).ToList();
- if (ans.Count() == 0)
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id).ToList())
- {
- rans1.Append(ConstructCell("0", CellValues.String));
- }
- }
- else
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id).ToList())
- {
- var Ques = AllQAnswer.Where(a => a.QuestionId == da.QuestionId && a.EachSurveyUniqueNo == co && a.SelectedAnswerOptionId == da.Id).FirstOrDefault();
- if (Ques !=null)
- {
- rans1.Append(ConstructCell(Ques.Value.ToString(), CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell("0", CellValues.String));
- }
- }
- }
- }
- if (qq.QuestionTypeId == 6)
- {
- var openeded = AllQAnswer.Where(a => a.QuestionId == qq.Id && a.EachSurveyUniqueNo == co).FirstOrDefault();
- if (openeded != null)
- {
- if (openeded.Description == null)
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell(openeded.Description, CellValues.String));
- }
-
- }
- else
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
-
- }
- }
- if (qq.QuestionTypeId == 7)
- {
- var ans = AllQAnswer.Where(m => m.QuestionId == qq.Id && m.EachSurveyUniqueNo == co).ToList();
- if (ans.Count() == 0)
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id).ToList())
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
- else
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id).ToList())
- {
- var Ques = AllQAnswer.Where(a => a.QuestionId == da.QuestionId && a.EachSurveyUniqueNo == co && a.SelectedAnswerOptionId == da.Id).FirstOrDefault();
- if (Ques != null)
- {
- rans1.Append(ConstructCell(Ques.Value.ToString(), CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
- }
- }
- if (qq.QuestionTypeId == 8)
- {
- var ans = AllQAnswer.Where(m => m.QuestionId == qq.Id && m.EachSurveyUniqueNo == co).ToList();
- if (ans.Count() == 0)
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id).ToList())
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
- else
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id).ToList())
- {
- var Ques = AllQAnswer.Where(a => a.QuestionId == da.QuestionId && a.EachSurveyUniqueNo == co && a.SelectedAnswerOptionId == da.Id).FirstOrDefault();
- if (Ques != null)
- {
- rans1.Append(ConstructCell(Ques.Value.ToString(), CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
- }
- }
- if (qq.QuestionTypeId == 9)
- {
- var ans = AllQAnswer.Where(m => m.QuestionId == qq.Id && m.EachSurveyUniqueNo == co).ToList();
- if (ans.Count() == 0)
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id).ToList())
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
- else
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id).ToList())
- {
- var Ques = AllQAnswer.Where(a => a.QuestionId == da.QuestionId && a.EachSurveyUniqueNo == co && a.SelectedAnswerOptionId == da.Id).FirstOrDefault();
- if (Ques != null)
- {
- rans1.Append(ConstructCell(Ques.Value.ToString(), CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
- }
- }
- if (qq.QuestionTypeId == 10)
- {
- var ans = AllQAnswer.Where(m => m.QuestionId == qq.Id && m.EachSurveyUniqueNo == co).ToList();
- if(ans==null)
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.ColumnOption == null).ToList())
- {
- foreach (var col in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.AnswerOption == null).ToList())
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
- }
- if (ans.Count() == 0)
- {
-
-
-
-
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.ColumnOption == null).ToList())
- {
- foreach (var col in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.AnswerOption == null).ToList())
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
- }
- else
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.ColumnOption==null).ToList())
- {
- foreach(var col in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.AnswerOption == null).ToList())
- {
- var fin = AllQAnswer.Where(a => a.QuestionId == qq.Id && a.RowId ==da.Id && a.ColumId == col.Id && a.EachSurveyUniqueNo == co).FirstOrDefault();
- if(fin!=null)
- {
- if(fin.Description==null)
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell(fin.Description, CellValues.String));
- }
-
- }
- else
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
-
- }
- }
- }
- }
- if (qq.QuestionTypeId == 11)
- {
- var ans = AllQAnswer.Where(m => m.QuestionId == qq.Id && m.EachSurveyUniqueNo == co).ToList();
- if (ans.Count() == 0)
- {
-
-
-
-
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.ColumnOption == null && m.DataOptions == null).ToList())
- {
- foreach (var col in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.AnswerOption == null && m.DataOptions == null).ToList())
- {
- if (col != null)
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
- }
- }
- else
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.ColumnOption == null && m.DataOptions==null).ToList())
- {
- foreach (var col in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.AnswerOption == null && m.DataOptions==null).ToList())
- {
- var fin = AllQAnswer.Where(a => a.QuestionId == qq.Id && a.RowId == da.Id && a.ColumId == col.Id && a.EachSurveyUniqueNo == co).FirstOrDefault();
- if (fin != null)
- {
- if(fin.Description==null)
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell(fin.Description, CellValues.String));
- }
-
- }
- else
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
-
- }
- }
- }
- }
- if (qq.QuestionTypeId == 12)
- {
- var ans = AllQAnswer.Where(m => m.QuestionId == qq.Id && m.EachSurveyUniqueNo == co).ToList();
- if (ans.Count() == 0)
- {
-
-
-
-
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.ColumnOption == null && m.DataOptions == null).ToList())
- {
- foreach (var col in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.AnswerOption == null && m.DataOptions == null).ToList())
- {
-
-
- rans1.Append(ConstructCell("NA", CellValues.String));
-
-
- }
- }
- }
- else
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.ColumnOption == null && m.DataOptions==null).ToList())
- {
- foreach (var col in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.AnswerOption == null && m.DataOptions==null).ToList())
- {
- var fin = AllQAnswer.Where(a => a.QuestionId == qq.Id && a.RowId == da.Id && a.ColumId == col.Id && a.EachSurveyUniqueNo == co).FirstOrDefault();
- if (fin != null)
- {
- var dataopt = AllQueAnswerOption.Where(a => a.Id == fin.SelectedDataId && a.QuestionId == qq.Id).FirstOrDefault();
- if(dataopt==null)
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell(dataopt.DataOptions, CellValues.String));
- }
-
- }
- else
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
-
- }
- }
- }
- }
- if (qq.QuestionTypeId == 13)
- {
- var ans = AllQAnswer.Where(m => m.QuestionId == qq.Id && m.EachSurveyUniqueNo == co).ToList();
- if (ans.Count() == 0)
- {
-
-
-
-
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.ColumnOption == null).ToList())
- {
- foreach (var col in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.AnswerOption == null).ToList())
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
- }
- else
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.ColumnOption == null).ToList())
- {
- foreach (var col in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.AnswerOption == null).ToList())
- {
- var fin = AllQAnswer.Where(a => a.QuestionId == qq.Id && a.RowId == da.Id && a.ColumId == col.Id && a.EachSurveyUniqueNo == co).FirstOrDefault();
- if (fin != null)
- {
- rans1.Append(ConstructCell(col.ColumnOption, CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
-
- }
- }
- }
- }
- if (qq.QuestionTypeId == 14)
- {
- var ans = AllQAnswer.Where(m => m.QuestionId == qq.Id && m.EachSurveyUniqueNo == co).ToList();
- if (ans.Count() == 0)
- {
-
-
-
-
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.ColumnOption == null).ToList())
- {
- foreach (var col in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.AnswerOption == null).ToList())
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
- }
- else
- {
- foreach (var da in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.ColumnOption == null).ToList())
- {
- foreach (var col in AllQueAnswerOption.Where(m => m.QuestionId == qq.Id && m.AnswerOption == null).ToList())
- {
- var fin = AllQAnswer.Where(a => a.QuestionId == qq.Id && a.RowId == da.Id && a.ColumId == col.Id && a.EachSurveyUniqueNo == co).FirstOrDefault();
- if (fin != null)
- {
- rans1.Append(ConstructCell(col.ColumnOption, CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
-
- }
- }
- }
- }
- if (qq.QuestionTypeId==15)
- {
- var openeded = AllQAnswer.Where(a => a.QuestionId == qq.Id && a.EachSurveyUniqueNo == co).FirstOrDefault();
- if (openeded!=null)
- {
- rans1.Append(ConstructCell(openeded.Value.ToString(), CellValues.String));
- }
- else
- {
- rans1.Append(ConstructCell("NA", CellValues.String));
- }
- }
-
- }
- count++;
- sheetData.AppendChild(rans1);
- }
- worksheetPart.Worksheet.Save();
-
- string contentType = "application/excel";
- spreadsheetDocument.Close();
-
- return File(fileName, contentType, "surveyExcel_Report"+System.DateTime.Now+".xlsx");
-
- }