0

I'm looking for a way to extract cell range from a spreadsheet document as an image file without any user action.

I able generating spreadsheet documents using OpenXML SDK. I want to define a cell range and use .NET to render these cells as Image. This function exists in Excel, I think it's possible to manage it using macro : Export bitmap image from Excel cells However I don't know if it exists a way to execute a macro with OpenXML SDK.

Can someone help me ? Thank you.

Community
  • 1
  • 1
Clément
  • 43
  • 5
  • OpenXML SDK and Excel perform different tasks. OpenXML SDK does not perform any Excel logic, it simply reads and writes to the file format. If you would like to perform Excel logic, use Excel. – user7116 Dec 05 '12 at 17:51
  • I read about Interrop service. It seams to be able to do that I want. – Clément Dec 05 '12 at 18:21
  • 1
    ... You can do this very easily through interop using the `Range.CopyPicture` method - Would that work for you?? – John Bustos Dec 05 '12 at 18:36
  • It can be driven by .NET on server without memory issues ? Any idea about how to do it without install Microsoft Office on server ? – Clément Dec 06 '12 at 07:51

1 Answers1

0

It's possible to manage Excel with interrop, about memory issues you just need to read Microsoft documentation about COM and Marshaling components

http://social.msdn.microsoft.com/Forums/fr-FR/visualcsharpfr/thread/e7c5109f-2beb-4669-b73c-50d28f29f6cf then read the clipboard and cast metadata bitmap into Bitmap class.

http://support.microsoft.com/default.aspx?scid=kb;en-us;317109 to avoid memory issues, you must implement NAR method as purposed.

I recommand you to put your logic in a STA thread if you use it in a Web app or a web service.

Clément
  • 43
  • 5