locked
Export Gridview to ppt RRS feed

  • Question

  • hi Team,

    I did export gridview to ppt but getting below error as

    The presentation cannot be opened. Your antivirus program may prevent you from opening the presentation. To fix this problem, make sure your antivirus program is current and working correctly. If the problem persists and the presentation is from someone that you trust, turn off your antivirus program, and then try to open the presentation again. If you do this, make sure you turn on your antivirus program again after you open the presentation.


    please check below my source code. Please send me reply ASAP.

    GridView1.AllowPaging =

    false;   ////////write this code only if paging is enabled.


                GridView1.DataBind();

    ////////write this code only if paging is enabled.


                Response.Clear();

                Response.Buffer =

    true;

                Response.ClearContent();

                Response.ClearHeaders();

                Response.Charset =

    "";

             

    //  Response.Charset = "";


               

    // If you want the option to open the Excel file without saving than


               

    // comment out the line below


               

    // Response.Cache.SetCacheability(HttpCacheability.NoCache);


               

    this.Response.ContentType = "application/vnd.ppt";

               

    this.Response.ContentType = "application/vnd.ms-powerpoint";

                Response.AddHeader(

    "content-disposition", "attachment;filename=1234.ppt");///////for text file write FileName.txt


             

               

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


                System.IO.

    StringWriterstringWrite = newSystem.IO.StringWriter();

                System.Web.UI.

    HtmlTextWriterhtmlWrite =newHtmlTextWriter(stringWrite);

                GridView1.RenderControl(htmlWrite);

                Response.Write(stringWrite.ToString());

                Response.End();

                GridView1.AllowPaging =

    true; ////////write this code only if paging is enabled.


                GridView1.DataBind();

    ////////write this code only if paging is enabled.


     
    Wednesday, September 17, 2014 9:20 AM