PHPExcel How to apply styles and set cell width and cell height to cell generated dynamically

后端 未结 2 1137
面向向阳花
面向向阳花 2020-12-29 10:31

I have form that I generate its content to Excel through PHPExcel, my problem is that how can I set width and height and also styles to the heading cells.

the excel

相关标签:
2条回答
  • 2020-12-29 10:52

    You can use

    $objWorksheet->getActiveSheet()->getRowDimension('1')->setRowHeight(40);
    $objWorksheet->getActiveSheet()->getColumnDimension('A')->setWidth(100);
    

    or define auto-size:

    $objWorksheet->getRowDimension('1')->setRowHeight(-1);
    
    0 讨论(0)
  • 2020-12-29 10:55

    Try this:

    $objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(40);
    
    0 讨论(0)
提交回复
热议问题