Export bitmap image from Excel cells

一世执手 提交于 2019-12-11 08:00:04

问题


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


回答1:


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/



来源:https://stackoverflow.com/questions/8852656/export-bitmap-image-from-excel-cells

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!