title: PHPExcel set font/background colour based on cell value
body: <p>I have a sheet pulling values based on </p>
  
  <pre><code>if ($slaHours &gt;= 0 &amp; $slaHours &lt;= 72) 
  </code></pre>
  
  <p>What I want to do is set the colour of those values if the value is less than 12. I still want to display the values greater than 12 and less than 72 so the code I've tried is </p>
  
  <pre><code>$styleArray = array(
  'font'  =&gt; array(
      'bold'  =&gt; true,
      'color' =&gt; array('rgb' =&gt; 'FF0000'),
  ));
  
  if ($slaHours &gt;= 0 &amp; $slaHours &lt;= 72)
      $slaHours = $objWorksheet-&gt;getCellByColumnAndRow(3, $row)-&gt;getValue();
      if($slaHours &lt;=12) {    
          $slaHours = $objWorksheet-&gt;getCellByColumnAndRow(3, $row)-&gt;getValue()-&gt;applyFromArray($styleArray); 
  </code></pre>
  
  <p>However, I'm getting a fatal error of </p>
  
  <blockquote>
    <p>"Call to a member function applyFromArray() on a non-object "</p>
  </blockquote>
  
  <p>Pretty new to this PHP stuff so any help in getting this working is greatly appreciated.</p>
  
  <p>Thanks</p>