Askanison4 Askanison4 -3 years ago 290
PHP Question

PHPExcel row autoheight on merged cells w/ wrapText

Is there a good way to set row autoheight in PHP Excel?
So far I have seen that you can use a fixed height where you specify before hand how tall you want the row. I have also seen that you can use autoheight if you are not using merged cells.

PHPExcel - dynamic row height for merged cells

How to set auto height in phpexcel?

These two other questions ask similar questions but neither is answered. One solution I've considered is to count the number of words in the cell and wrap based on that and the column span. This could open a can of worms however.

Answer Source

You can also do it like this

  1. Merge cells you want, for example: A7:C7
  2. Copy context of it to one cell for instance Z7
  3. Set the width of the merged cells to Z7
  4. Apply Wrap Text to the Z7
  5. Make Z7 not visible
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download