title: set cell,title export to excel in codeigniter 2++
body: <p>Dear all</p>
  
  <p>I'm a newbie in PHP, and bad in English.</p>
  
  <p>i have a controler</p>
  
  <pre><code>function download($id)
  {
      $file_name = 'report1';
      $fieldnames ='Tanggal,Bulan,Block,Afdeling,Jumlah Panen Terakhir';
      $query = $this-&gt;main_model-&gt;get_report($id);
      to_excel($query,$file_name,$fieldnames,$judul);
  }
  </code></pre>
  
  <p>this is my link/anchor</p>
  
  <pre><code>anchor("report/report/download/$id",'download', array('class' =&gt; 'excel'))
  </code></pre>
  
  <p>and this is my helper</p>
  
  <pre><code>&lt;?php if (!defined('BASEPATH')) exit('No direct script access allowed');
  function to_excel($query, $filename='exceloutput', $fieldnames)
  {
   $columnnames = explode(",", $fieldnames); //better looking column names instead
   $headers = ''; // just creating the var for field headers to append to below
   $data = ''; // just creating the var for field data to append to below
  
   $obj =&amp; get_instance();
  
   $fields = $query-&gt;field_data();
   if ($query-&gt;num_rows() == 0) {
        echo '&lt;p&gt;The table appears to have no data.&lt;/p&gt;';
   } else {
         $i = 0;
        foreach ($fields as $field) {
  
           $headers .= $columnnames[$i]."\t";
           $i++;
        }
  
        foreach ($query-&gt;result() as $row) {
             $line = '';
             foreach($row as $value) {                                            
                  if ((!isset($value)) OR ($value == "")) {
                       $value = "\t";
                  } else {
                       $value = str_replace('"', '""', $value);
                       $value = '"' . $value . '"' . "\t";
                  }
                  $value = utf8_decode($value);
                  $line .= $value;
             }
             $data .= trim($line)."\n";
        }
  
        $data = str_replace("\r","",$data);
  
        header("Content-type: application/x-msdownload");
        header("Content-Disposition: attachment; filename=$filename.xls");
        echo "$headers\n$data";  
   }
   } ?&gt;
  </code></pre>
  
  <p>and this is my output</p>
  
  <p><img src="https://i.stack.imgur.com/uhrRk.png" alt="enter image description here"></p>
  
  <p>and the question is </p>
  
  <p>the 'tanggal' mysql type is timestamp but when i drag resize the cell the value is show
  like this</p>
  
  <p><img src="https://i.stack.imgur.com/nvpCI.png" alt="enter image description here"></p>
  
  <p>so how to set large a cell in to_excel_helper?</p>
  
  <p>and how to set title and border?</p>
  
  <p>so it becomes like this</p>
  
  <p><img src="https://i.stack.imgur.com/xPMkb.png" alt="enter image description here"></p>
  
  <p>Thank you so much for your attention</p>
  
  <p>this part make me stress since 1 week ago</p>
  
  <p>so i need your help</p>