Setting width of spreadsheet cell using PHPExcel

后端 未结 7 963
萌比男神i
萌比男神i 2021-01-31 13:20

I\'m trying to set the width of a cell in an Excel document generated with PHPExcel with:

$objPHPExcel->getActiveSheet()->getColumnDimensionByColumn(\'C\')         


        
7条回答
  •  醉梦人生
    2021-01-31 14:00

    This worked for me:

    $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(false);
    $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(10);
    

    be sure to add setAuzoSize(false), before the setWidth(); as Rolland mentioned

提交回复
热议问题