The following code exports some data, downloading it in an XLS file.
What I want is to give all the three list and export each list of data in a separate sheet. How can I do that?
My code looks like this:
public bool ExportQuestionSet(int QuestionSetNo)
{
ExportResponse response = new ExportResponse();
QuestionSetTbl questionSetTbl = _questionSetDAO.GetQuestionSetByQuestionSetNo(QuestionSetNo);
QuestionSetContract questionSetContract = GetQuestionSetByQuestionSetNo(QuestionSetNo);
GridView gv = new GridView();
gv.DataSource = questionSetContract.QuestionsInfoList;
gv.DataBind();
Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment; filename=QuestionSet.xls");
Response.ContentType = "application/ms-excel";
Response.Charset = "";
StringWriter sw = new StringWriter();
System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
gv.RenderControl(htw);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();
return response.TaskComplete;
}