title: Set column properties in Excel using PHP
body: <p>I am writing an application that runs an oracle query and exports the data in Excel format. The problem that I am facing is a column named Tran_code in excel file is to be <code>00</code>. When my code runs and generates the Excel, it prints single 0 instead of 00.</p>
  
  <p><strong>Setting cell value in an array:</strong></p>
  
  <pre><code>$_SESSION['report_values'][$sno][19]=  "'00"; //Setting cell value in an array
  </code></pre>
  
  <p><strong>Setting headers and values to Excel File</strong></p>
  
  <pre><code>include_once("class.export_excel.php");
  $excel_obj-&gt;setHeadersAndValues($_SESSION['report_header'],$_SESSION['report_values']); // 
  $excel_obj-&gt;GenerateExcelFile();
  </code></pre>
  
  <p><strong>class.export_excel.php</strong></p>
  
  <pre><code>&lt;?php
  class ExportExcel
  {
  //variable of the class
  var $titles=array();
  var $all_values=array();
  var $filename;
  
  //functions of the class
  function ExportExcel($f_name) //constructor
  {
      $this-&gt;filename=$f_name;
  }
  function setHeadersAndValues($hdrs,$all_vals) //set headers and query
  {
  
  //$this-&gt;setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_TEXT );
      $this-&gt;titles=$hdrs;
      $this-&gt;all_values=$all_vals;
  }
  function GenerateExcelFile() //function to generate excel file
  {
  
      foreach ($this-&gt;titles as $title_val) 
      { 
          $header .= $title_val."\t"; 
  
      } 
      for($i=0;$i&lt;sizeof($this-&gt;all_values);$i++) 
      { 
          $line = ''; 
          foreach($this-&gt;all_values[$i] as $value) 
          { 
              if ((!isset($value)) OR ($value == "")) 
              { 
                  $value = "\t"; 
              } //end of if
              else 
              { 
  
                  $value = str_replace('"', '""', $value); 
                  $value = '"' . $value . '"' . "\t"; 
              } //end of else
              $line .= $value; 
          } //end of foreach
          $data .= trim($line)."\n"; 
      }//end of the while 
      $data = str_replace("\r", "", $data); 
      if ($data == "") 
      { 
          $data = "\n(0) Records Found!\n"; 
      } 
      //echo $data;
      header("Content-type: application/vnd.ms-excel"); 
      header("Content-Disposition: attachment; filename=$this-&gt;filename"); 
      header("Pragma: no-cache"); 
      header("Expires: 0"); 
      print "$header\n$data";  
  
  
  }
  
  }
  ?&gt;
  </code></pre>