setAutoSize not working as intended?

Topics: Developer Forum, Project Management Forum, User Forum
Sep 11, 2008 at 1:58 PM
I think I really found a bug now :-) or maybe it is not important and the developer didnt put much thought into.
I just run all my columns through a loop with $objPHPExcel->getActiveSheet()->getColumnDimension($a)->setAutoSize(true);
Some columns were sized correctly, some were to small some were a little to big and some empty ones were as big as a whole sheet.
I know think this is a bug :-)

Excel Writer 5
Sep 11, 2008 at 5:37 PM
Thank you for your report. The problem with the too wide columns using PHPExcel_Writer_Excel5 indeed looks like a bug! A work item has been created:

The part with the imprecise columns may be much harder to resolve at the moment. The problem is that in PHPExcel the algorithm for calculating the auto size column width is not yet as sophisticated as the one of MS Office Excel. PHPExcel's algorithm is based on character count and font size while MS Office Excel also takes into account the glyph widths.

Sep 12, 2008 at 9:24 AM
to be honest, i am using open office and the resize algorithm works there too. maybe, since its open source, you can borrow some code. :-)
Sep 12, 2008 at 9:25 AM
oh, its already fixed, nice!