Click here to Skip to main content
14,236,142 members
Rate this:
Please Sign up or sign in to vote.
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 4 days ago
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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

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

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100