如何使用vb.net中的oledbadapter从excel中检索位图图像

问题描述:

您好我现在有一个程序使用oledpadapter从excel文件中检索信息并将数据显示到datagridview中。我希望找到一种方法从我的excel文件中检索位图图像并将其显示到我的datagridview中。有这么简单的方法吗?我非常感谢任何人给予的任何帮助或建议!

Hello right now I have a program that uses the oledpadapter to retrieve information from an excel file and displays the data into a datagridview. I'm hoping to find a way to retrieve a bitmap image from my excel file and display it into my datagridview. Is there an easy way of doing this? I greatly appreciate any help or suggestions anyone can give!

在我看来,不可能因为Excel存储图像的方式在其文件中。看看这里: http://*.com/questions/2632715/retrieve -pictures-from-excel-file-using-oledb [ ^ ]
In my opinion it's not possible because of the way in which Excel stores images in its files. Have a look here: http://*.com/questions/2632715/retrieve-pictures-from-excel-file-using-oledb[^]


不是这样,因为ole接口只允许您访问单元格。图像不在单元格中,它们是显示在实际Excel网格上方的单独对象。但您可以使用 Excel互操作 [ ^ ]或第三方库,可以在没有安装excel的情况下读取excel文件。但是使用这种方法,您需要逐个单元地解析表格单元格 - 逐个对象,您将无法将其视为表格。如果你使用的是Excel 2007或更高版本,那么就有一个表概念,你也可以利用这个概念(从这个VBA开始: http://www.jkp-ads.com/Articles/Excel2007TablesVBA.asp [ ^ ],但你会发现它也是VB.NET的等价物。)
Not this way, since the ole interface is giving you access to the cells only. The images are not in the cells, they are separate objects shown above the actual Excel grid. But you can use Excel interop[^] or third party libraries that can read excel files without excel being installed. But with this approach, you need to parse the sheet cell by cell - object by object, you won't be able to see it as a table. If you are using Excel 2007 or above, there is a "Table" concept, you could also tale advantage of (start with this VBA intro: http://www.jkp-ads.com/Articles/Excel2007TablesVBA.asp[^], but you will find it's VB.NET equivalent also).