title: I wanted to append data in a pre formatted Excel sheet using php(for some reason I can't use the third party tools like phpexcel)
body: <p>I have a pre formatted excel file(excel 2007) with the fixed header and footer, I need to append the data from SQL server. 
  I have tried to use code like:</p>
  
  <pre><code>header("Content-type:application/vnd.ms-excel");
  header("Content-Disposition:filename=$filename");
  </code></pre>
  
  <p>in php to create a new file, but it can't do more control with the sheet's layout, and for some reasons we can't use the third party tools, anybody can give me some advice?</p>
  
  <p>code like this：</p>
  
  <pre><code>$res = mssql_query($sql, $conn);
  $row = mssql_num_rows($res);
  if ($row &gt; 0) {
      echo "&lt;table border='1'&gt;";
      echo "table header";
      for ($i = 0; $i &lt; $row; $i++) {
      $row[$i] = mssql_fetch_assoc($res);
      echo "&lt;tr&gt;";
      echo "&lt;td&gt;data here:{$row[$i]['workdate']}&lt;/td&gt;";
      }    
  }
  </code></pre>
  
  <p>excel sheet like this:
  LOGO IMG HERE<br>
                  PHYSICIAN BI-WEEKLY TIME SHEET                          </p>
  
  <pre><code>CHS Entity:     userinfo1                               
  Department:     userinfo2                               
  Name:       userinfo3                               
  Pay Period End Date:        2016/10/8                               
  
          Please accept this time record as attestation and confirmation of my time.  See undersigned     
  </code></pre>
  
  <p>table head here:<br>
      Date/Day        Attendance Code Time In Time Out     Hours  Administrative Code On Call SFH (# of hrs)  Good Sam Oncall (# of hrs)  Research    Notes
              Please click on box under code to select options.<br>
  data start here：    datarow1<br>
                      datarow2<br>
                      ...<br>
          Total Hours             0.00        0.00    0.00<br>
  footer here:<br>
          Employee Signature &amp; Certification:  I reviewed my attendance record……<br>
          Aprover's Name &amp; Signature:                                 </p>