title: export a php file to excel
body: <p>How can we set style to the table while export a php file  to excel </p>
  
  <p>using the following code we can export a php file to excel</p>
  
  <pre><code>header("Content-Disposition: attachment; filename=".$fname."Application.xls");
  
  print "&lt;html xmlns:x=\"urn:schemas-microsoft-com:office:excel\"&gt;
  &lt;style&gt;
  
  @page
      {margin:1.0in .75in 1.0in .75in;
      mso-header-margin:.5in;
      mso-footer-margin:.5in;}
  tr
      {mso-height-source:auto;}
  col
      {mso-width-source:auto;}
  br
      {mso-data-placement:same-cell;
      }
  
  .style0
      {mso-number-format:General;
      text-align:general;
      vertical-align:bottom;
      white-space:nowrap;
      mso-rotate:0;
      mso-background-source:auto;
      mso-pattern:auto;
      color:windowtext;
      font-size:10.0pt;
      font-weight:400;
      font-style:normal;
      text-decoration:none;
      font-family:Arial;
      mso-generic-font-family:auto;
      mso-font-charset:0;
      border:none;
      mso-protection:locked visible;
      mso-style-name:Normal;
      mso-style-id:0;}
  td
      {mso-style-parent:style0;
      padding-top:1px;
      padding-right:1px;
      padding-left:1px;
      mso-ignore:padding;
      color:windowtext;
      font-size:10.0pt;
      font-weight:400;
      font-style:normal;
      text-decoration:none;
      font-family:Arial;
      mso-generic-font-family:auto;
      mso-font-charset:0;
      mso-number-format:General;
      text-align:general;
      vertical-align:bottom;
      border:none;
      mso-background-source:auto;
      mso-pattern:auto;
      mso-protection:locked visible;
      white-space:nowrap;
      mso-rotate:0;}
  .grids
      {mso-style-parent:style0;
      border:.5pt solid windowtext;}.head{
      font-weight:bold;
  }
  
  &lt;/style&gt;
  &lt;head&gt;
  &lt;!--[if gte mso 9]&gt;&lt;xml&gt;
  &lt;x:ExcelWorkbook&gt;
  &lt;x:ExcelWorksheets&gt;
  &lt;x:ExcelWorksheet&gt;
  &lt;x:Name&gt;Application List&lt;/x:Name&gt;
  &lt;x:WorksheetOptions&gt;
  &lt;x:Print&gt;
  &lt;/x:Print&gt;
  &lt;/x:WorksheetOptions&gt;
  &lt;/x:ExcelWorksheet&gt;
  &lt;/x:ExcelWorksheets&gt;
  &lt;/x:ExcelWorkbook&gt; 
  &lt;/xml&gt;
  &lt;![endif]--&gt; 
  &lt;/head&gt;
  &lt;body&gt;";
  
  print '&lt;table width="100%" border="0" cellspacing="1" cellpadding="2" class="tbl_content"&gt;';
  
  print ' &lt;tr class="head" valign="bottom"&gt;
                                                          &lt;td align="center" width="7%" height="22"&gt;&lt;b&gt;SL No&lt;/b&gt;&lt;/td&gt;
                                                      &lt;td align="left" width="18%"&gt;&lt;b&gt;Name Of Party&lt;/b&gt;&lt;/td&gt;
                                                      &lt;td align="left" width="18%"&gt;&lt;b&gt;Godown&lt;/b&gt;&lt;/td&gt;
                                                      &lt;td align="center" width="16%" &gt;&lt;b&gt;Invoice No&lt;/b&gt;&lt;/td&gt;
                                                      &lt;td align="center" width="12%"&gt;&lt;b&gt;Date&lt;/b&gt;&lt;/td&gt;
                                                      &lt;td align="right" width="17%"&gt;&lt;b&gt;Taxable Turnover&lt;/b&gt;&lt;/td&gt;
                                                      &lt;td align="right" width="14%"&gt;&lt;b&gt;VAT Amount&lt;/b&gt;&lt;/td&gt;
                                                      &lt;td align="right" width="8%"&gt;&lt;b&gt;Cess Amt.&lt;/b&gt;&lt;/td&gt;
                                                      &lt;td align="right" width="16%"&gt;&lt;b&gt;Total Turnover&lt;/b&gt;&lt;/td&gt;
                                                  &lt;/tr&gt;';   
  
  print '&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;';  
  </code></pre>
  
  <p>but the style is not taken when display in browser.</p>