如何使用PHP将图像(png)嵌入Excel [英] how to embed image(png) to Excel using php

查看:241
本文介绍了如何使用PHP将图像(png)嵌入Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面的方法使用PHP将数据输出到excel文件,

I use below to output data to a excel file using PHP,

展开 | 选择 | Wrap | 行号

推荐答案

HTML img元素不包含图像数据。它包含对图像的引用,您可以在错误消息中清楚地看到。
the HTML img element does not contain image data. it holds a reference to the image, as you can clearly see in the error message.


您确定要创建Excel电子表格吗?看起来更像是在创建类似于Excel创建的HTML文件。


要创建Excell文件,您需要采用完全不同的方法。


我经常输出一个Excel文件,Excel可以打开,但我从未尝试过包含图像。还有一个叫做Excel Spreadsheet Writer的PEAR,它非常强大 - 它可能就是你所需要的。
Are you sure you are creating an Excel spreadsheet? Looks more like you are creating an HTML file similar to one created by Excel.

To create an Excell file, you need a whole different approach.

I often output a CSV file, which Excel can open, but I have never tried to include images. There is also a PEAR thing called something like Excel Spreadsheet Writer which is pretty powerful - it may be what you need.


是的它确实创建了一个xls文件,但正如我之前所说,它无法嵌入base64编码的png文件中的图像。我尝试使用不同的方法:将base64编码的png文件更改为png文件并将其保存在服务器中然后我使用< img>标签以显示图像。但是现在我的问题是,当我从服务器删除图像时,xls中的图像也会消失,因为它只是一个链接我猜。有什么建议吗?
Yes it does create an xls file, but as I said before, it cannot embed images from base64 encoded png files. I tried to use different approach : change the base64 encoded png file to a png file and save it in the server then I use <img> tag to display the images. But my problem now, when I delete the images from server, the image in the xls is also disappear because it''s only a link I guess. Any suggestions?


这篇关于如何使用PHP将图像(png)嵌入Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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