title: How to styling the cell in PHPexcel?
body: <p>I would like to:</p>
  
  <p>1) set min-width of the cell </p>
  
  <p>On the internet there is some discussion about this , but I find the code not work:</p>
  
  <pre><code>$objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension('A')-&gt;setWidth(100);
  </code></pre>
  
  <p>the column size is not expand according to the data size / preset width</p>
  
  <p>2) underline the cell</p>
  
  <p>I am making an account table, so I would like to underline some row</p>
  
  <pre><code>$styleArray = array(
    'borders' =&gt; array(
      'bottom' =&gt; array(
        'style' =&gt; PHPExcel_Style_Border::BORDER_THIN
      )
    )
  );
  
  $sheet-&gt;getStyle('A1')-&gt;applyFromArray($styleArray);
  </code></pre>
  
  <p>However the underline is not exist, I wonder is it due to the border also count as 1 line? for example , if A1 is underlined, then I need to user A3 for the next row.</p>
  
  <p>Thanks a lot for helping.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>1) set min-width:</p>
  
  <p>From the source code the column is a number instead of string , so I try like this but still no luck</p>
  
  <pre><code>    $excel-&gt;getActiveSheet()-&gt;getColumnDimensionByColumn(0)-&gt;setAutoSize(false);
      $excel-&gt;getActiveSheet()-&gt;getColumnDimensionByColumn(0)-&gt;setWidth('4.42');
  </code></pre>
  
  <p>2) underline is working now</p>
  
  <pre><code>    $border_bottom = array(
          'borders' =&gt; array(
              'bottom' =&gt; array(
                  'style' =&gt; PHPExcel_Style_Border::BORDER_THIN
              )
          )
      );
  
      $excel-&gt;getActiveSheet()-&gt;getStyle("7")-&gt;applyFromArray($border_bottom);
  </code></pre>
  
  <p>it works, but just wondering can I underline when set cell instead of hardcode the position: A1:B2 etc... </p>