locked
Send data to excel RRS feed

  • Question

  • User243563075 posted

    hi all,
    I have record all employee data in a table and i present data with an asp.net web page. when user enter EmployeeID Employee details are shown on a web page . this data also contains picture of selected employee. And i need to send all the data- that is belogn selected employee- to excel.

    In fact the most diffucelt point is saving pictures pf selected employee.

    How can i achieve this?

    thanx in advance

    Friday, August 6, 2010 2:33 AM

Answers

  • User-1802908944 posted

    bind a gridview/ listview with your datatable.

    Response.Clear();
    Response.AddHeader("content-disposition", "attachment;filename=defalut.xls");
    Response.Charset = "";
    Response.ContentType = "application/vnd.xls";
    System.IO.StringWriter stringWrite = new System.IO.StringWriter();
    System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
    Gridview1.RenderControl(htmlWrite);
    Response.Write(stringWrite.ToString());
    Response.End();

    these about line convert your images in excel sheet


    check please

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 6, 2010 8:26 AM