从Excel单元格导出位图图像 [英] Export bitmap image from Excel cells

查看:299
本文介绍了从Excel单元格导出位图图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用OpenXML框架创建了一个.xlsx文件,并且将其嵌入到PowerPoint幻灯片(也使用OpenXML创建)中,问题是我需要一个占位符图像,Excel中PowerPoint的幻灯片上的OleObject - 我可以使用标准的占位符,但这看起来不错。



所以我希望(最有可能使用Interop)找到打开.xlsx文件的方法,并将相关单元格作为位图导出(.jpg或.png) ),然后我可以将其作为占位符图像输入到我的OleObject中。



我遇到这个: http://csharp.net-informations.com/excel/csharp-excel-chart-export.htm



我正在尝试做什么,但是在图表对象上,所以如果有人知道一种将单元格(理想的选择,而不是整个工作表)导出到位图的方法,谢谢,



Mike

解决方案

Excel范围对象具有 CopyPicture 方法,可以执行您要查找的内容。



JP有一个VBA示例发布,你应该给你所需要的。



http://www.jpsoftwaretech.com/export-excel-range-to-a-picture-file/


I have created an .xlsx file using the OpenXML framework and I am embedding it into a PowerPoint slide (also created using OpenXML) the problem is that I need a placeholder image for the OleObject the Excel sits in on the PowerPoint slide - i can use a standard placeholder, but this looks bad.

So I was hoping (most likely using Interop) to find a way of opening the .xlsx file and exporting the relevant cells as a bitmap (.jpg or .png ideally) which I can then feed into my OleObject as the placeholder image.

I came across this: http://csharp.net-informations.com/excel/csharp-excel-chart-export.htm

Which does what I am trying to do, but on a Chart object, so if someone knows a way to export cells (ideally a selection, rather than the whole worksheet) to a bitmap, that would be great!

Thanks,

Mike

解决方案

An Excel Range object has a CopyPicture method that does what you're looking for.

JP has a VBA example posted that you should give you what you need.

http://www.jpsoftwaretech.com/export-excel-range-to-a-picture-file/

这篇关于从Excel单元格导出位图图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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