Hi.. Anandm
Thanks for ur respon, i have create for that chart, but i want to export to ms excel that chart , may be you will give me some helps..
i put my sample code for ur reference..
regards
Ruben
public ActionResult CreateCountryGDPBar()
{
var chart = new System.Web.Helpers.Chart(width: 500, height: 200, theme: ChartTheme.Blue)
.AddTitle("Fuel Level")
.AddSeries(
chartType: "Line",
name: "StudyType",
xValue: new[] { "USA", "China", "Japan", "Germany", "UK", "France", "India" },
yValues: new[] { "300", "250", "200", "150", "120", "100", "50" })
.GetBytes("png");
return File(chart, "image / bytes");
}
public void ExportData()
{
DateRangeModelproenergi model = new DateRangeModelproenergi();
string tanggalTo = model.ToDate.ToString("dd-MMM-yyyy");
Response.ClearContent();
Response.ContentType = "application/force-download";
Response.AddHeader("content-disposition",
"attachment; filename=Delivery Report" + ".xls");
Response.Write("<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">");
Response.Write("<head>");
Response.Write("<META http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">");
Response.Write("<!--[if gte mso 9]><xml>");
Response.Write("<x:ExcelWorkbook>");
Response.Write("<x:ExcelWorksheets>");
Response.Write("<x:ExcelWorksheet>");
Response.Write("<x:Name>Report Data</x:Name>");
Response.Write("<x:WorksheetOptions>");
Response.Write("<x:Print>");
Response.Write("<x:ValidPrinterInfo/>");
Response.Write("</x:Print>");
Response.Write("</x:WorksheetOptions>");
Response.Write("</x:ExcelWorksheet>");
Response.Write("</x:ExcelWorksheets>");
Response.Write("</x:ExcelWorkbook>");
Response.Write("</xml>");
Response.Write("<![endif]--> ");
View("~/Areas/ProEnergi/Views/DetailTripReport/ExportAll.cshtml").ExecuteResult(this.ControllerContext);
Response.Flush();
Response.End();
}