从Excel单元格导出位图图像 [英] Export bitmap image from Excel cells
问题描述
所以我希望(最有可能使用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屋!