Exporting gridview to microsoft powerpoint in c#
<p>I want to export gridview to powerpoint.I have the following code.But I have the following problems:</p>

<ol>
<li><p>when I am using it for ms office 2010.its giving error:</p>

<blockquote>
  <p>Powerpoint cannot read c:\users\filename.ppt. 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.</p>
</blockquote></li>
<li><p>when I am using it for ms office 2007,its opening but there is no gridview</p></li>
</ol>

<p>CODE:</p>

<pre><code>       Response.Clear();

       Response.Buffer = true;

       Response.AddHeader("content-disposition", "attachment;filename=FileName.ppt");

       Response.Cache.SetCacheability(HttpCacheability.NoCache);
       Response.Charset = ""; 
     //  this.Response.ContentType = "application/vnd.openxmlformats-       officedocument.presentationml.presentation";

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

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

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

    GridView2.AllowPaging = false; 

    GridView2.DataBind();

    System.IO.StringWriter stringWrite = new System.IO.StringWriter(); 
    System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); 
    GridView2.RenderControl(htmlWrite);

     Response.Write(stringWrite.ToString());

   Response.End();
   Response.Flush();
</code></pre>
