sandeep
sandeep

Reputation: 2882

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

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.

Upvotes: 3

Views: 2822

Answers (1)

Mark Baker
Mark Baker

Reputation: 212412

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);

Upvotes: 4

Related Questions