PHPExcel:在将图像添加到Excel工作表

时间:2015-05-10 06:49:23

标签: phpexcel

我正在生成一份excel报告,其中有一张护照尺寸图片列。我想根据记录提取逐个将图像添加到该列。

我将图片添加到工作表的代码如下:

                    $columnID = getExcelColumnValue($dataColumn);
                    //$objPHPExcel->getActiveSheet()->getStyle($columnID . $dataRow)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                    $objDrawing = new PHPExcel_Worksheet_Drawing();
                    $objDrawing->setPath(BASE_URL.$value);
                    $objDrawing->setCoordinates($columnID . $dataRow);
                    $objDrawing->setHeight(36);
                    $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());

错误是这样的:

Fatal error: Uncaught exception 'PHPExcel_Exception' with message 'File http://128.199.210.59/data_collection/v2/images/formData/554dfdb0252e89781b90416a/1431176847206615.jpg not found!' in /var/www/data_collection/v2/php/api/PHPExcel/Classes/PHPExcel/Worksheet/Drawing.php:114 Stack trace: #0 /var/www/data_collection/v2/php/processing/formDashboard/exportToExcel.php(110): PHPExcel_Worksheet_Drawing->setPath('http://128.199....') #1 {main} thrown in /var/www/data_collection/v2/php/api/PHPExcel/Classes/PHPExcel/Worksheet/Drawing.php on line 114 

图像文件出现在目的地,仍显示错误...

0 个答案:

没有答案