title: with phpexcel how do I set column formats?
body: <p>I am using an existing Excel file, with the first row containing plain text, to be used later as template. I then changed a few of the column formats to currency, accounting, date...e.t.c. Now I am loading in this file in phpExcel and populating data from my database to this file and saving it with a new name. But on the saved file, all cells in the newly created rows seem to be marked <code>general</code>, though the original plain text row still seems to have the correct format assigned.</p>
  
  <p>My Code:</p>
  
  <pre><code>$xl_tmplt = ((isset($_REQUEST['excel_template']) &amp;&amp; $_REQUEST['excel_template'] != "") 
      ? $_REQUEST['excel_template'] 
      : "report_tab1.xlsx");
  
  require_once 'includes/classes/PHPExcel/PHPExcel.php';
  
  $cacheMethod   = PHPExcel_CachedObjectStorageFactory:: cache_to_phpTemp;
  $cacheSettings = array('memoryCacheSize' =&gt; '8MB');
  PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
  
  $tmp_workbook = PHPExcel_IOFactory::load($tmp_folder_path . '/templates/' . $xl_tmplt);
  $tmp_workbook-&gt;setActiveSheetIndex(0);
  
  $sheet = $tmp_workbook-&gt;getActiveSheet();
  $sheet-&gt;fromArray($arr, '', 'A2');
  
  $objWriter = PHPExcel_IOFactory::createWriter($tmp_workbook, 'Excel2007');
  $objWriter-&gt;save($tmp_folder_path . "output/$filename");
  
  $result['type'] = "success";
  $result['msg']  = "The file was successfully created.";
  </code></pre>
  
  <p>Any idea how I can load in an excel file with predefined column formats and use it to generate a new excel? Or change/set the format of a column or cell range during generation?</p>
  
  <p>PS: I am not too good with excel so I might have set the column format in the wrong way. basically I clicked on the column letter which selects the column, and then changed the format in the dropdown above. If this is wrong, please let me know.</p>