User-330142929 posted
Hi Paminchever,
According to your description, you don’t want to use rdlc report library to achieve what you want. Here is a workaround, firstly we could save chart image via chartcontrol.saveimage method, secondly write image to excel file, I have made a demo below:
Aspx.
<div>
<asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource1">
<Series>
<asp:Series Name="Series1" XValueMember="Name" YValueMembers="Price"></asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1"></asp:ChartArea>
</ChartAreas>
</asp:Chart>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [Products]"></asp:SqlDataSource>
<asp:Button ID="Button1" runat="server" Text="Export" OnClick="Button1_Click" />
</div>
Code-Behind.
protected void Button1_Click(object sender, EventArgs e)
{
string imgPath2 = "D://1.png";
this.Chart1.SaveImage(imgPath2,System.Web.UI.DataVisualization.Charting.ChartImageFormat.Png);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode("test.xls"));
Response.ContentType = "application/vnd.ms-excel";
StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
string headerTable = @"<Table><tr><td><img src='" + imgPath2 + @"' /></td></tr></Table>";
Response.Write(headerTable);
Response.Write(stringWrite.ToString());
Response.End
How it works.

if you have any question, please feel free to let me know.
Best Regards,
Abraham