title: generating XLS file with PHP adds blank row at the top of xls file
body: <p>i have developed reporting system for one website.i have developed script such that my client can export sales data in XLS file with all detail, every thing was working fine, but now i noticed that every generating xls file has blank row at the top,i have not make any change in code, before few days it was not happening. how to remove that blank line from the top  </p>
  
  <p>i am using following code to generate xls file:</p>
  
  <pre><code>$str = "No\tOrderId\tFirst Name\tLast Name\tOrder Date\tTime\tAddress\tCity\tState\tZip\tCountry\tPhone\tEmail\tProductId\tProductName\tProductQty\t";
  
          $output = array();
          $output[] = $str;
  
  
  while($row = $res-&gt;fetch())
          {
              $datetime = new DateTime($row['DateTime']);
  
              $date = $datetime-&gt;format('Y-m-d');
              $time = $datetime-&gt;format('H:i:s');
  
              $Country = getCountryName($row['Country']);
  
              $stroutput= $cnt."\t".$row['OrderId']."\t".stripslashes($row['FirstName'])."\t".stripslashes($row['LastName'])."\t".$date."\t".$time."\t".$row['Address1']."\t".$row['City']."\t".$row['State']."\t".$row['Zip']."\t".$Country."\t".$row['Phone']."\t".$row['Email']."\t".$row['ProductId']."\t".$row['ProductName']."\t".$row['ProductQty']."\t";
  
  
  
                  $output[]=$stroutput;
                  $cnt++;
          }
  $filename="CustomReport_".$date33."_".$date55."_".date("mdy-His");
          $data = implode("\n", $output);
          header("Content-type: application/octet-stream");
          header("Content-Disposition: attachment; filename=".$filename.".xls;");
          header("Content-Type: application/ms-excel");
          header("Pragma: no-cache");
          header("Expires: 0");
          print "$header\n$data"; 
  </code></pre>