解决办法是在PHPExcel_Style_Alignment 和PHPExcel_Style_Border 前面加上"\"符号,就完美解决了
$objPHPExcel->getActiveSheet()->getStyle(‘A‘)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
在thinkphp的使用中最后的 PHPExcel_Style_Alignment::HORIZONTAL_CENTER 要写成
\PHPExcel_Style_Alignment::HORIZONTAL_CENTER才能调用到。
PHPExcel生成Excel文件---提示Class 'PHPExcel_Style_Alignment' not found
原文地址:https://www.cnblogs.com/dayin1/p/11696338.html
时间: 2024-10-26 14:38:02