on-internet
← Community

PHPExcel auto size column width

Stack Overflow ·

I'm trying to auto size the columns of my sheet. I'm writing the file and in the end I try to resize all of my columns. // Add some data $objPHPExcel->setActiveSheetIndex(0) ->setCellValue('B1', 'test1111111111111111111111') ->setCellValue('C1', 'test1111111111111') ->setCellValue('D1', 'test1111111') ->setCellValue('E1', 'test11111') ->setCellValue('F1', 'test1') ->setCellValue('G1', 'test1'); foreach($objPHPExcel->getActiveSheet()->getColumnDimension() as $col) { $col->setAutoSize(true); } $objPHPExcel->getActiveSheet()->calculateColumnWidths(); The above code doesn't work. Doesn't change th

Comments

Sign in or sign up to comment and upvote.

No comments yet.