在excel中插入图片 [英] Insert picture in excel

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

问题描述

大家好,



我正在尝试通过编码在excel中插入图像。

以下代码插入图片到表格。没关系。但我的图像不在文件系统中。我正在从数据库中检索它们。没有将图像保存到文件系统有没有办法直接将它们添加到Excel中?



Hi all,

I'm trying to insert an image in excel through coding.
The following code inserts a picture in to the sheet. Its fine. But my images are not in filesystem. I'm retrieving them from database. Without saving the images into filesystem is there a way to directly add them in to excel?

'ws is worksheet object
ws.Shapes.AddPicture("myimage.jpg", MsoTriState.msoFalse, MsoTriState.msoTrue, 1, 1, 2, 3)





语言:vb.net

Excel:Excel.dll ver 11.0(Office 2003)



请建议。



Language : vb.net
Excel : Excel.dll ver 11.0 ( Office 2003)

Kindly suggest.

推荐答案

看看这里 [ ^ ]一个例子是在C#中,但我认为理解并不是问题或者它或翻译 [ ^ ]它。



如果你可以将BLOB字段读入内存或图像位图,你就回家了! ;)

选项1

将此数据保存到临时文件夹中( C:\ Temp ),使用选项 SaveWithDocument = True 将图片添加到工作表中,并从临时文件夹中删除图片。



选项2

当图片在内存中时,您可以将其内容纳入工作表;)

Take a look here[^] An example is in C#, but i think it's not problem to understand it or translate[^] it.

If you can read BLOB field into a memory or image bitmap, you're home! ;)
Option 1
Save this data into temporary folder (C:\Temp), add picture to the worksheet with option SaveWithDocument=True and delete picture from temporary folder.

Option 2
When a picture is in memory, you can pate it content into Worksheet ;)
wsh.Range("A1").Select
wsh.Paste()





更多信息:添加图片方法 [ ^ ]


http://vb.net-informations.com/excel-2007/vb.net_excel_2007_insert_picture.htm [ ^ ]


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

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