Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
all the data are coming to excel but without images.kindly suggest code

What I have tried:

<pre> Response.Clear();

            Response.AddHeader("content-disposition", "attachment;filename=SubstationAvailabilityReport.xls");

            Response.Charset = "";

            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            Response.ContentType = "application/vnd.xls";

            System.IO.StringWriter stringWrite = new System.IO.StringWriter();

            System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);

            

            Place.RenderControl(htmlWrite);

            Response.Write(stringWrite.ToString());

            Response.End();
Posted
Updated 11-Jul-19 10:33am
Comments
F-ES Sitecore 4-Jul-19 3:45am    
That code doesn't create an Excel file. Google "create excel file asp.net" and you'll find some libraries that can do this for you like OpenXML, EPPlus etc.
Member 14143173 4-Jul-19 4:33am    
could you please suggest code because my asp.net does not support EPPlus namespace

1 solution

I'd suggest to EPPlus[^]. This is very good library!

Take a look here: Shapes, Pictures and Charts in EPPlus[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900