PHPExcel icon indicating copy to clipboard operation
PHPExcel copied to clipboard

AUTOSIZE_METHOD_EXACT does not resize column as 'exact' as possible

Open michaelnguyen2021 opened this issue 8 years ago • 1 comments

I am using PHPExcel 1.8.0 due to issue with 1.8.1 (Valid Directory to TrueType Font files not specified https://github.com/PHPOffice/PHPExcel/issues/556 )

Here is my code


#here is code to put data $objPHPExcel object

\PHPExcel_Shared_Font::setAutoSizeMethod(\PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT);
foreach(range('A', 'K') as $columnID)
{
    $objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
}

# here is code to output in Excel2007 format (xlsx)

And this is the screenshot of excel

2016-03-08_1216

Column 'A', 'B' and 'C' have too much extra white spaces. There are no differences in setting PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT or not.

I expect the excel looks like below 2016-03-08_1221

Do I miss anything ?

michaelnguyen2021 avatar Mar 08 '16 19:03 michaelnguyen2021

Hi! Same problem here. My columns have too much extra white spaces. There are no differences in setting PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT or not. What was the soloution? Please give me an advice...

it2semi avatar Oct 31 '17 06:10 it2semi