Jump to content
Software FX Community

chart missing when exporting to the excel


Recommended Posts

  • 2 weeks later...

I used this to export as excel format, HTH private void ExportToExcel(string strFileName, DataView dv)



Response.AddHeader("content-disposition", "attachment; filename=" + strFileName);

Response.ContentType =

"application/excel";System.IO.StringWriter sw = new System.IO.StringWriter();

HtmlTextWriter htw = new HtmlTextWriter(sw);

//Instantiate a datagridSystem.Web.UI.WebControls.DataGrid dg = new System.Web.UI.WebControls.DataGrid();

dg.DataSource = dv;


//Tell the datagrid to render itself to htmltextwriter





Link to comment
Share on other sites


 Thanks for the additional info. Unfortunately, I don't believe this approach will work with Chart FX.

While the DataGrid Control ultimately renders as an HTML table, the generated charts are basically images. The RenderControl call for the chart object returns the HTML that refers to an image on the server.

You may want to work with the Office libraries instead in order to create a new Excel file with an embedded image. I found some information on line that may be of help:






Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...