可以先读取出来放到剪切板,然后再从剪切板读取高" />
乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > c#如何从Excel中读取<em>图片</em>-读取excel 图片,excel调用文件夹图片

c#如何从Excel中读取<em>图片</em>-读取excel 图片,excel调用文件夹图片

作者:乔山办公网日期:

返回目录:excel表格制作


参考zhidaohttp:///farrell/archive/2008/01/24/1051273.html

可以先读取出来放到剪切板,然后再从剪切板读取
高版本的EXCEL 默认开启了压缩图片功能, 你在选项关闭后就一样了

//引用Excel命名空间
using Excel;
//......
//下面从test.xls中的2,2格复制图片到剪贴板,然后从剪贴板读取图片并显示到pictureBox1中。
private void btnGetImageFromExcel_Click(object sender, EventArgs e)
{
//初始化excel对象
Excel.Application excel = new Excel.Application();
//打开xls文件(注意:后面的参e799bee5baa6e997aee7ad94e4b893e5b19e366数都用Type.Missing填充,表示使用参数的默认值)
excel.Workbooks.Open(@"D:\Documents and Settings\xrwang\桌面\test.xls", System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing);
//选定到第2行第2列所在的单元格
Range r = (Range)excel.Cells[2, 2];
r.Select();
//将单元格复制到剪贴板中
r.CopyPicture(XlPictureAppearance.xlScreen, XlCopyPictureFormat.xlBitmap);
//退出excel
excel.Quit();
//判断剪贴板中是否存在图片,如果存在,则将图片显示到pictureBox1中
if (Clipboard.ContainsImage())
{
Image image=Clipboard.GetImage();
pictureBox1.Image = image;
}
}

相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网