If you want to export an image in PHPEXCEL, you can use phpexcel to export an excel file. However, you need to export an image at the same time. How can I implement the code? I am very grateful to you for your reference!
Reply to discussion (solution)
Phpexcel is a very powerful class, it should be OK. Read the document.
Read the usage of the PHPExcel_Worksheet_Drawing class.
Can I post the source code? a lot of points
$p = new PHPExcel();$p->getActiveSheet()->setCellValue('D8', 'Image');$d = new PHPExcel_Worksheet_Drawing();$d->setPath('03.gif');$d->setCoordinates('D10');$d->setWorksheet($p->getActiveSheet());$t = PHPExcel_IOFactory::createWriter($p, 'Excel5');$t->save('tu.xls');
Phpexcel is a very powerful class, it should be OK. Read the document. It is recommended that there are many examples on the Internet.
PHP code
$ P = new PHPExcel ();
$ P-> getActiveSheet ()-> setCellValue ('d8', 'image ');
$ D = new PHPExcel_Worksheet_Drawing ();
$ D-> setPath('03.gif ');
$ D-> setCoordinates ('d10 ');
$ D-> setWorksheet ($ p-> getAct ......
Learn how to export images!
PHP code
$ P = new PHPExcel ();
$ P-> getActiveSheet ()-> setCellValue ('d8', 'image ');
$ D = new PHPExcel_Worksheet_Drawing ();
$ D-> setPath('03.gif ');
$ D-> setCoordinates ('d10 ');
$ D-> setWorksheet ($ p-> getAct ...... I used to export images, but I haven't seen any mistakes.
The image must be a "local" image like this http://17zencart.com/data/attachment/forum/201210/13/135720yffmf02fbd202fsf.png such images seem to be unable to import my approach is to first use the image downloaded to the local and then added to the excel inside do not know whether there is another more convenient method is how to center images on top of my images.
$ ObjDrawing = new PHPExcel_Worksheet_Drawing ();
$ ObjDrawing-> setName ('photo ');
$ ObjDrawing-> setDescription ('image inserted by pyxjm ');
$ Imgpath = "your image address absolute path"
$ ObjDrawing-> setPath ($ imgpath );
$ ObjDrawing-> setWidth ('25pt ');
$ ObjDrawing-> setHeight ('20pt ');
$ ObjDrawing-> setOffsetX (2 );
$ ObjDrawing-> getShadow ()-> setVisible (true );
$ ObjDrawing-> setCoordinates ($ array [$ k]. $ d );
// $ ObjDrawing-> setMimeType (PHPExcel_Worksheet_MemoryDrawing: MIMETYPE_DEFAULT );
$ ObjDrawing-> setWorksheet ($ objExcel-> getActiveSheet ());
This is the code for exporting an English path image in phpexcel, but it cannot be used in Chinese. Currently, the solution is in progress.-If you solve this problem first, please let me know --
PHP code? 12345678910 $ p = new PHPExcel (); $ p-> getActiveSheet ()-> setCellValue ('d8', 'image'); $ d = new PHPExcel_Worksheet_Drawing (); $ d-> setPath('03.gif '); $ d-> setCoordinates ('d10'); $ d-> setWor ......
The moderator is really good, tested and easy to use!
Why is an error reported when I add images to the loop? How to export multiple images?
The image must be a "local" image like this http://17zencart.com/data/attachment/forum/201210/13/135720yffmf02fbd202fsf.png such images seem to be unable to import my approach is to first use the image downloaded to the local and then added to the excel inside do not know whether there is another more convenient method is how to center images on top of my images.
It seems that this is the only option ~~