How to set auto height in phpexcel?

前端 未结 4 1404
旧巷少年郎
旧巷少年郎 2021-02-01 01:42

I am using phpexcel to generate excel document with PHP.

the question is, how to make auto height row using phpexcel? many thanks :)

相关标签:
4条回答
  • 2021-02-01 01:53
    $excel->getActiveSheet()->getDefaultRowDimension()->setRowHeight(-1);
    
    0 讨论(0)
  • 2021-02-01 02:06

    To change height of all rows to auto you can do:

    foreach($xls->getActiveSheet()->getRowDimensions() as $rd) { 
        $rd->setRowHeight(-1); 
    }
    
    0 讨论(0)
  • 2021-02-01 02:07
    $excel->getActiveSheet()->getRowDimension(1)->setRowHeight(-1);
    

    Should set the row height to 'auto' for row 1.

    0 讨论(0)
  • 2021-02-01 02:12

    You can set it by using following code,

    $objPHPExcel->getActiveSheet()->getRowDimension(1)->setRowHeight(-1);
    $objPHPExcel->getActiveSheet()->getStyle('E')->getAlignment()->setWrapText(true);
    
    0 讨论(0)
提交回复
热议问题