php_excel07- how to fix min heigth and mak to grow height based on the contents of a cell

StackOverflow https://stackoverflow.com/questions/3881623

  •  28-09-2019
  •  | 
  •  

Question

I have to Export data to xlsx, where the exported file should be in a pre defined format. Becoz of these i am using "PHPexcel". And i created a template of some format with each row with some specified height.

Actually in each cell i will be writing the data dynamically. so if the text is larger, then the row height in not increased.

So is ther anyway so tat row height is increased to fit the cell text.

Was it helpful?

Solution

To set a row to autofit:

$objPHPExcel->getActiveSheet()->getRowDimension(10)->setAutoSize(true);

And then set the individual cells to allow wrapping

$objPHPExcel->getActiveSheet()->getStyle('A10:D10')->getAlignment()->setWrapText(true);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top