title: PHPExcel - dynamic row height for merged cells
body: <p>After a lot of trial and error, I still can't seem to figure out a workaround to get merged cells to have an AutoFit height. </p>
  
  <p>I've tried an approach based on a bit of VBA code I found at this site: <a href="https://groups.google.com/forum/?fromgroups=#!topic/microsoft.public.excel.programming/pcvg7o5sKhA" rel="noreferrer">https://groups.google.com/forum/?fromgroups=#!topic/microsoft.public.excel.programming/pcvg7o5sKhA</a></p>
  
  <p>The following code pastes the text, wraps it, and changes the width of the cell (A1) to the total width of the merged cells I want. Then, it merges the cells and sets column A back down to the original width. $note is any long string of text. $vAlignTop is an array setting the alignment the text to the top of the cell.</p>
  
  <pre><code>$totalWidth = 67.44; //width of columns A-H
  
  $objPHPExcel-&gt;getActiveSheet()-&gt;setCellValue('A1', $note);
  $objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension('A')-&gt;setWidth($totalWidth);
  $objPHPExcel-&gt;getActiveSheet()-&gt;getStyle('A1')-&gt;getAlignment()-&gt;setWrapText(true);
  $objPHPExcel-&gt;getActiveSheet()-&gt;getStyle('A1:H1')-&gt;applyFromArray($vAlignTop);
  $objPHPExcel-&gt;getActiveSheet()-&gt;mergeCells('A1:H1');
  $objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension('A')-&gt;setWidth(8.43); //original width of column A
  </code></pre>
  
  <p>When I go through these same steps manually in excel, I get the result I want, but the output of the code above is always the default 12.75 row height.</p>
  
  <p>Anyone have any ideas? I don't really mind having to hardcode the column widths, i just want the height to be responsive to the text.</p>
  
  <p>Thanks in advance.</p>