Export tabe Excel in Asp.net

Export tabe Excel in Asp.net

using System.IO;
using System.Web.UI;
using System.Web;


protected void Lnk_Excel_Click(object sender, EventArgs e)
    {
        //imgSchool.Visible = false;
        StringWriter sw = new StringWriter();
        HtmlTextWriter h = new HtmlTextWriter(sw);
        prntDiv.RenderControl(h);
        string str = sw.GetStringBuilder().ToString();
        Response.AppendHeader("content-disposition", "attachment;filename=Student strength report.xls");
        Response.Charset = "";
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.ContentType = "application/vnd.ms-excel";
        this.EnableViewState = false;
        Response.Write(str);
        Response.End();
    }

No comments:

Post a Comment

IIS deployment support details

  Node JS - IIS deployment support details node: http://go.microsoft.com/?linkid=9784334 IISNode: https://github.com/azure/iisnode/releases/...