如何在codeiniter中使用phpexcel将图像插入excel [英] How to insert an image into excel using phpexcel in codeiniter

查看:101
本文介绍了如何在codeiniter中使用phpexcel将图像插入excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I am using phpexcel with codeigniter. I want to insert an image to excel file.and i am using below code

but it gives the error for file. It says file not found. But that file exists in correct folder. And I gave correct path. Please help me.The file exists in assets folder.





我尝试了什么:





What I have tried:

$objDrawing = new PHPExcel_Worksheet_Drawing();
				$objDrawing->setName('Logo');
				$objDrawing->setDescription('Logo');
				$logo = base_url() . 'images/logo.png'; // Provide path to your logo file
				$objDrawing->setPath($pr_file);
				$objDrawing->setOffsetX(8);    // setOffsetX works properly
				$objDrawing->setOffsetY(300);  //setOffsetY has no effect
				$objDrawing->setCoordinates('B1');
				$objDrawing->setHeight(75); // logo height
				$objDrawing->setWorksheet($this->excel->getActiveSheet());

推荐答案

objDrawing = new PHPExcel_Worksheet_Drawing();
objDrawing = new PHPExcel_Worksheet_Drawing();


objDrawing-> setName(' Logo' );
objDrawing->setName('Logo');


objDrawing-> setDescription(' Logo' );
objDrawing->setDescription('Logo');


这篇关于如何在codeiniter中使用phpexcel将图像插入excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆