html 到 excel 转换为嵌入图像

标签 html excel image vba

我有我的 html 文件,其中包含 html 表格和使用标签的嵌入图像 [ img src="data:image/png;base64, ] 。我想将其转换为 excel,图像列显示实际图像。当我在 excel 中打开此 html 文件时,表格显示正常,但图像显示如图所示带有红十字占位符 Excel import with embedded image

有没有办法将这个 base64 编码的图像转换为在 excel 单元格中显示?

问候

最佳答案

更新了上面 Peter 的回答。我又花了一个小时左右的时间才弄清楚如何处理这个问题。以下是如何构建 html 文件的示例:

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="12345"

--12345
Content-Type: image/jpg;name="logo.jpg"
Content-Transfer-Encoding: base64
Content-ID: <logo.jpg@site.com>

/9j/4QAYRXhpZgAASUkqAAgAAAAAAAA...
--12345
Content-Type: text/html; charset="utf-8"

<html>
    <!-- Your HTML -->
    <!-- Somewhere in the HTML, replace your images with this, matching the content-id you created above -->
    <img width="your width" height="your height" src="cid:logo.jpg@site.com" />
</html>
--12345--

这可以对多个图像进行多次,只是使用不同的名称/内容 ID。您必须在末尾添加该行才能使其正常工作。

关于html 到 excel 转换为嵌入图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37901299/

相关文章:

php - 显示可能通过 HTTP POST (PHP + MySQL) 更改的项目列表的最佳做法是什么

javascript - 在所有浏览器上强制更新缓存

asp.net - 生成文件,然后启动安全下载

excel - 根据单元格值插入多个形状

image - 如何使用 Microsoft Access 显示来自 Sql Server 的图像?

html - 自己的图像作为范围上的 slider 拇指。如何在 css 上设置样式

html - 使图像在其他图像下方对齐

html - 设置网站高度css

excel - Workbook_BeforeClose() 在第一部分起作用,但不关闭 Workbook

html - 图像不工作 - 这是一个 Chrome 错误吗?