How to create charts in excel,While exporting data from database to excel sheet..!
I'm exporting data to excel from database.I need to create chart in the excel sheet based on data from database. Below code creates simple excel sheet I need to make changes in the same code to create charts. Please Guide
public ActionResult ExportToExcel()
{
var workbook = new ClosedXML.Excel.XLWorkbook();
var worksheet = workbook.Worksheets.Add("SheetOne");
DocumentFormat.OpenXml.Drawing.PictureLocks piclocks = new DocumentFormat.OpenXml.Drawing.PictureLocks();
worksheet.Cell("A1").Value = "Test data!";
Response.ClearContent();
Response.Buffer = true;
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment;filename=\"SheetOne.xlsx\"");
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
workbook.SaveAs(memoryStream);
memoryStream.WriteTo(Response.OutputStream);
memoryStream.Close();
Response.End();
return File(memoryStream, "application/ms-excel", "PPs_Workflow.xlsx");
} *