I'm generating an Excel sheet using AUTOSIZE_METHOD_EXACT
$xl = new PHPExcel();
$xl->getDefaultStyle()->getFont()->setName('Arial')->setSize(10);
// ... generate sheet contents here
PHPExcel_Shared_Font::setAutoSizeMethod(PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT);
$xlWrite = new PHPExcel_Writer_Excel2007($xl);
$xlWrite->save($filename);
The script dies with Uncaught exception: PHPExcel_Exception: GD library needs to be enabled in /path/to/vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/Font.php on line 306
I think the error is misleading, because as per phpinfo(), GD is actually enabled. Looking at the code, the exception is thrown because function imagettfbbox() does not exist. The PHP Manual says that This function is only available if PHP is compiled with freetype support (--with-freetype-dir=DIR )
Maybe a more accurate message would be useful.
This is with phpoffice/phpexcel 1.8.1 (installed via Composer)
I'm generating an Excel sheet using AUTOSIZE_METHOD_EXACT
The script dies with Uncaught exception: PHPExcel_Exception: GD library needs to be enabled in /path/to/vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/Font.php on line 306
I think the error is misleading, because as per phpinfo(), GD is actually enabled. Looking at the code, the exception is thrown because function
imagettfbbox()
does not exist. The PHP Manual says that This function is only available if PHP is compiled with freetype support (--with-freetype-dir=DIR )Maybe a more accurate message would be useful.
This is with phpoffice/phpexcel 1.8.1 (installed via Composer)