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.
You can also do it like this
You can do it with this code:
$width=84;
$height=20;
$text="abcde...";
$excel->getActiveSheet()->getRowDimension(1)->setRowHeight(ceil(strlen($text)/$width)*$height);
'height' in code is of textline in cell, not for whole cell.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.