日期:2014-05-17  浏览次数:20588 次

ASP.NET 如何能获取到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文件(注意:后面的参数都用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;
}
}
------解决方案--------------------
http://ufo-crackerx.blog.163.com/blog/static/113078778201201542333900/
------解决方案--------------------
顶 之前也有问word里的图片获取问题的,看到没有解决,期待这次,,,