phpexcel 导出多张图片
<br />//写入excel<br />function getExcel($fileName,$headArr,$data){<br /> if(empty($data) || !is_array($data)){<br /> die("data must be a array");<br /> }<br /> if(empty($fileName)){<br /> exit;<br /> }<br /> $date = date("Y_m_d h:i:s",time());<br /> $fileName .= "_{$date}.xlsx";<br /> <br /> //创建新的PHPExcel对象<br /> $objPHPExcel = new PHPExcel();<br /> $objProps = $objPHPExcel->getProperties();<br /> <br /> //设置表头<br /> $key = ord("A");<br /> foreach($headArr as $v){<br /> $colum = chr($key);<br /> $objPHPExcel->setActiveSheetIndex(0) ->setCellValue($colum.'1', $v);<br /> $key += 1;<br /> }<br /> <br /> //表数据<br /> $column = 2;<br /> $objActSheet = $objPHPExcel->getActiveSheet();<br /> foreach($data as $key => $rows){ //行写入<br /> $span = ord("A");<br /> foreach($rows as $keyName=>$value){// 列写入<br /> $j = chr($span);<br /> //我想在此处加入图片的code但是不成功,应该怎么写,请提示下<br /><br /> // $objDrawing = new PHPExcel_Worksheet_Drawing();<br /> // $objDrawing->setName(‘test’);<br /> // $objDrawing->setDescription(‘test’);<br /> // $objDrawing->setPath($data['imgurl']);<br /> // $objDrawing->setHeight(36);<br /> // $objDrawing->setCoordinates(''); 这里应该怎么写??<br /> // $objDrawing->setWorksheet($objActSheet);<br /><br /><br /> $objActSheet->setCellValue($j.$column, $value);<br /> $span++;<br /> }<br /> $column++;<br /> }<br /> //重命名表<br /> $objPHPExcel->getActiveSheet()->setTitle('记录');<br /> $fileName = iconv("utf-8", "gb2312", $fileName);<br /> $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');<br /> $objWriter->save($fileName); //脚本方式运行,保存在当前目录<br /> exit;<br />}<br />