title: Excel file not opening after completion of download?
body: <p>By using the fallowing code I have exported the data table to excel .</p>
  
  <pre><code>Response.ClearContent();
  Response.Write(@"&lt;!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN""&gt;");
  Response.AddHeader("content-disposition", attachment);
  Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  Response.Charset = "utf-8";
  string tab = string.Empty;
  
  Response.Write("&lt;font style='font-size:11.0pt; font-family:Calibri;'&gt;");
  
  Response.Write("&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;");
  
  Response.Write("&lt;Table border='1' bgColor='#ffffff' borderColor='#000000' cellSpacing='0' cellPadding='0' style='font-size:11.0pt; font-family:Calibri; background:white;'&gt; &lt;TR&gt;");
  
  foreach (DataColumn datacol in dt.Columns)
  {
      Response.Write("&lt;Td style = "+"\"width:120px;\""+"&gt;");
      Response.Write("&lt;B&gt;");
      Response.Write(tab + datacol.ColumnName);
      Response.Write("&lt;/B&gt;");
      Response.Write("&lt;/Td&gt;");
  }
  Response.Write("&lt;/TR&gt;");
  
  foreach (DataRow dr in dt.Rows)
  {
      Response.Write("&lt;TR&gt;");
      for (int j = 0; j &lt; dt.Columns.Count; j++)
      {
          Response.Write("&lt;Td&gt;");
          Response.Write(tab + Convert.ToString(dr[j]));
          Response.Write("&lt;/Td&gt;");
      }
  
      Response.Write("&lt;/TR&gt;");
  }
  HttpContext.Current.Response.Write("&lt;/Table&gt;");
  Response.Write("&lt;/font&gt;");
  Response.Flush();
  Response.End();
  </code></pre>
  
  <p>When i am trying to open the downloaded excel file it showing the following message </p>
  
  <p><img src="https://i.stack.imgur.com/Wns1l.png" alt="enter image description here"></p>
  
  <p>is any changes needed in my code . can you please help out from this.</p>
  
  <p>thanks,   purna</p>