I my application I displayed the linechart using Ajax ControlToolKit then i need to Export linechart to Excel sheet(open office/Libra office). Is it possible to do this? and tell me how can i do this. thank you.
aspx code:
ValueAxisLineColor="#D08AD9" BaseLineColor="#A156AB" Style="margin-right: 7px" >
VenkatRank #1,497 · 1.1K reputationPosted Jul 22, 2016, 6:53 PM EDT
Kk18 reputationPosted Jul 27, 2016, 10:46 PM EDT
{
Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "MTTraining-Accuracy.xls"));
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
base.OnPreRender(e);
ScriptManager sm = ScriptManager.GetCurrent(Page);
sm.RegisterScriptControl(LineChart1);
grdMTPerformance.AllowPaging = false;
grdMTPerformance.HeaderRow.Style.Add("background-color", "#FFFFFF");
for (int i = 0; i < grdMTPerformance.HeaderRow.Cells.Count; i++)
{
grdMTPerformance.HeaderRow.Cells[i].Style.Add("background-color", "#df5015");
}
LineChart1.RenderControl(htw);
grdMTPerformance.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}
{
/* Verifies that the control is rendered */
base.OnPreRender(e);
ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
if (scriptManager == null)
{
this.LineChart1.Visible = true;
scriptManager = new ScriptManager();
scriptManager.ID = "ToolkitScriptManager1";
scriptManager.EnablePartialRendering = true;
Controls.AddAt(0, scriptManager);
}
}
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts